Sfoglia il codice sorgente

Added macro for RC5 timing

Clara Hobbs 7 anni fa
parent
commit
bc2ce7672d
1 ha cambiato i file con 10 aggiunte e 5 eliminazioni
  1. 10
    5
      src/main.c

+ 10
- 5
src/main.c Vedi File

@@ -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…
Annulla
Salva