Browse Source

Added macro for RC5 timing

Clara Hobbs 7 years ago
parent
commit
bc2ce7672d
1 changed files with 10 additions and 5 deletions
  1. 10
    5
      src/main.c

+ 10
- 5
src/main.c View File

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
 #define NEC_START_PULSE 45
69
 #define NEC_START_PULSE 45
65
 #define NEC_END_PULSE 405
70
 #define NEC_END_PULSE 405
161
 {
166
 {
162
     if (bit) {
167
     if (bit) {
163
         pwmDisableChannel(&PWMD1, 0);
168
         pwmDisableChannel(&PWMD1, 0);
164
-        gptPolledDelay(&GPTD4, 889);
169
+        gptPolledDelay(&GPTD4, RC5_PULSE_LENGTH);
165
         pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000));
170
         pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000));
166
-        gptPolledDelay(&GPTD4, 889);
171
+        gptPolledDelay(&GPTD4, RC5_PULSE_LENGTH);
167
     } else {
172
     } else {
168
         pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000));
173
         pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000));
169
-        gptPolledDelay(&GPTD4, 889);
174
+        gptPolledDelay(&GPTD4, RC5_PULSE_LENGTH);
170
         pwmDisableChannel(&PWMD1, 0);
175
         pwmDisableChannel(&PWMD1, 0);
171
-        gptPolledDelay(&GPTD4, 889);
176
+        gptPolledDelay(&GPTD4, RC5_PULSE_LENGTH);
172
     }
177
     }
173
 }
178
 }
174
 
179
 

Loading…
Cancel
Save