Browse Source

Consistent _useTimerX tests

Scott Lahteine 6 years ago
parent
commit
49229d97db
2 changed files with 14 additions and 14 deletions
  1. 4
    4
      Marlin/src/HAL/HAL_AVR/ServoTimers.h
  2. 10
    10
      Marlin/src/HAL/HAL_AVR/servo_AVR.cpp

+ 4
- 4
Marlin/src/HAL/HAL_AVR/ServoTimers.h View File

75
 #endif
75
 #endif
76
 
76
 
77
 typedef enum {
77
 typedef enum {
78
-  #if ENABLED(_useTimer1)
78
+  #ifdef _useTimer1
79
     _timer1,
79
     _timer1,
80
   #endif
80
   #endif
81
-  #if ENABLED(_useTimer3)
81
+  #ifdef _useTimer3
82
     _timer3,
82
     _timer3,
83
   #endif
83
   #endif
84
-  #if ENABLED(_useTimer4)
84
+  #ifdef _useTimer4
85
     _timer4,
85
     _timer4,
86
   #endif
86
   #endif
87
-  #if ENABLED(_useTimer5)
87
+  #ifdef _useTimer5
88
     _timer5,
88
     _timer5,
89
   #endif
89
   #endif
90
   _Nbr_16timers
90
   _Nbr_16timers

+ 10
- 10
Marlin/src/HAL/HAL_AVR/servo_AVR.cpp View File

95
 #ifndef WIRING // Wiring pre-defines signal handlers so don't define any if compiling for the Wiring platform
95
 #ifndef WIRING // Wiring pre-defines signal handlers so don't define any if compiling for the Wiring platform
96
 
96
 
97
   // Interrupt handlers for Arduino
97
   // Interrupt handlers for Arduino
98
-  #if ENABLED(_useTimer1)
98
+  #ifdef _useTimer1
99
     SIGNAL(TIMER1_COMPA_vect) { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
99
     SIGNAL(TIMER1_COMPA_vect) { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
100
   #endif
100
   #endif
101
 
101
 
102
-  #if ENABLED(_useTimer3)
102
+  #ifdef _useTimer3
103
     SIGNAL(TIMER3_COMPA_vect) { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
103
     SIGNAL(TIMER3_COMPA_vect) { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
104
   #endif
104
   #endif
105
 
105
 
106
-  #if ENABLED(_useTimer4)
106
+  #ifdef _useTimer4
107
     SIGNAL(TIMER4_COMPA_vect) { handle_interrupts(_timer4, &TCNT4, &OCR4A); }
107
     SIGNAL(TIMER4_COMPA_vect) { handle_interrupts(_timer4, &TCNT4, &OCR4A); }
108
   #endif
108
   #endif
109
 
109
 
110
-  #if ENABLED(_useTimer5)
110
+  #ifdef _useTimer5
111
     SIGNAL(TIMER5_COMPA_vect) { handle_interrupts(_timer5, &TCNT5, &OCR5A); }
111
     SIGNAL(TIMER5_COMPA_vect) { handle_interrupts(_timer5, &TCNT5, &OCR5A); }
112
   #endif
112
   #endif
113
 
113
 
114
 #else // WIRING
114
 #else // WIRING
115
 
115
 
116
   // Interrupt handlers for Wiring
116
   // Interrupt handlers for Wiring
117
-  #if ENABLED(_useTimer1)
117
+  #ifdef _useTimer1
118
     void Timer1Service() { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
118
     void Timer1Service() { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
119
   #endif
119
   #endif
120
-  #if ENABLED(_useTimer3)
120
+  #ifdef _useTimer3
121
     void Timer3Service() { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
121
     void Timer3Service() { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
122
   #endif
122
   #endif
123
 
123
 
126
 /****************** end of static functions ******************************/
126
 /****************** end of static functions ******************************/
127
 
127
 
128
 void initISR(timer16_Sequence_t timer) {
128
 void initISR(timer16_Sequence_t timer) {
129
-  #if ENABLED(_useTimer1)
129
+  #ifdef _useTimer1
130
     if (timer == _timer1) {
130
     if (timer == _timer1) {
131
       TCCR1A = 0;             // normal counting mode
131
       TCCR1A = 0;             // normal counting mode
132
       TCCR1B = _BV(CS11);     // set prescaler of 8
132
       TCCR1B = _BV(CS11);     // set prescaler of 8
145
     }
145
     }
146
   #endif
146
   #endif
147
 
147
 
148
-  #if ENABLED(_useTimer3)
148
+  #ifdef _useTimer3
149
     if (timer == _timer3) {
149
     if (timer == _timer3) {
150
       TCCR3A = 0;             // normal counting mode
150
       TCCR3A = 0;             // normal counting mode
151
       TCCR3B = _BV(CS31);     // set prescaler of 8
151
       TCCR3B = _BV(CS31);     // set prescaler of 8
163
     }
163
     }
164
   #endif
164
   #endif
165
 
165
 
166
-  #if ENABLED(_useTimer4)
166
+  #ifdef _useTimer4
167
     if (timer == _timer4) {
167
     if (timer == _timer4) {
168
       TCCR4A = 0;             // normal counting mode
168
       TCCR4A = 0;             // normal counting mode
169
       TCCR4B = _BV(CS41);     // set prescaler of 8
169
       TCCR4B = _BV(CS41);     // set prescaler of 8
173
     }
173
     }
174
   #endif
174
   #endif
175
 
175
 
176
-  #if ENABLED(_useTimer5)
176
+  #ifdef _useTimer5
177
     if (timer == _timer5) {
177
     if (timer == _timer5) {
178
       TCCR5A = 0;             // normal counting mode
178
       TCCR5A = 0;             // normal counting mode
179
       TCCR5B = _BV(CS51);     // set prescaler of 8
179
       TCCR5B = _BV(CS51);     // set prescaler of 8

Loading…
Cancel
Save