瀏覽代碼

Added macro for RC5 timing

Clara Hobbs 7 年之前
父節點
當前提交
bc2ce7672d
共有 1 個檔案被更改,包括 10 行新增5 行删除
  1. 10
    5
      src/main.c

+ 10
- 5
src/main.c 查看文件

@@ -59,7 +59,12 @@
59 59
 
60 60
 
61 61
 /*
62
- * NEC timing macros
62
+ * RC5 timing macros (microseconds)
63
+ */
64
+#define RC5_PULSE_LENGTH 889
65
+
66
+/*
67
+ * NEC timing macros (tenths of a millisecond)
63 68
  */
64 69
 #define NEC_START_PULSE 45
65 70
 #define NEC_END_PULSE 405
@@ -161,14 +166,14 @@ void rc5_bit(bool bit)
161 166
 {
162 167
     if (bit) {
163 168
         pwmDisableChannel(&PWMD1, 0);
164
-        gptPolledDelay(&GPTD4, 889);
169
+        gptPolledDelay(&GPTD4, RC5_PULSE_LENGTH);
165 170
         pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000));
166
-        gptPolledDelay(&GPTD4, 889);
171
+        gptPolledDelay(&GPTD4, RC5_PULSE_LENGTH);
167 172
     } else {
168 173
         pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000));
169
-        gptPolledDelay(&GPTD4, 889);
174
+        gptPolledDelay(&GPTD4, RC5_PULSE_LENGTH);
170 175
         pwmDisableChannel(&PWMD1, 0);
171
-        gptPolledDelay(&GPTD4, 889);
176
+        gptPolledDelay(&GPTD4, RC5_PULSE_LENGTH);
172 177
     }
173 178
 }
174 179
 

Loading…
取消
儲存