Przeglądaj źródła

Added macro for RC5 timing

Clara Hobbs 7 lat temu
rodzic
commit
bc2ce7672d
1 zmienionych plików z 10 dodań i 5 usunięć
  1. 10
    5
      src/main.c

+ 10
- 5
src/main.c Wyświetl plik

@@ -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
 

Ładowanie…
Anuluj
Zapisz