Browse Source

#if defined => #ifdef / PIN_EXISTS

Scott Lahteine 7 years ago
parent
commit
cd882b88db

+ 2
- 2
Marlin/MarlinSerial.cpp View File

@@ -89,7 +89,7 @@ FORCE_INLINE void store_char(unsigned char c) {
89 89
     }
90 90
   }
91 91
 
92
-  #if defined(M_USARTx_UDRE_vect)
92
+  #ifdef M_USARTx_UDRE_vect
93 93
     ISR(M_USARTx_UDRE_vect) {
94 94
       _tx_udr_empty_irq();
95 95
     }
@@ -97,7 +97,7 @@ FORCE_INLINE void store_char(unsigned char c) {
97 97
 
98 98
 #endif // TX_BUFFER_SIZE
99 99
 
100
-#if defined(M_USARTx_RX_vect)
100
+#ifdef M_USARTx_RX_vect
101 101
   ISR(M_USARTx_RX_vect) {
102 102
     unsigned char c  =  M_UDRx;
103 103
     store_char(c);

+ 7
- 7
Marlin/Marlin_main.cpp View File

@@ -10212,35 +10212,35 @@ void prepare_move_to_destination() {
10212 10212
   void setPwmFrequency(uint8_t pin, int val) {
10213 10213
     val &= 0x07;
10214 10214
     switch (digitalPinToTimer(pin)) {
10215
-      #if defined(TCCR0A)
10215
+      #ifdef TCCR0A
10216 10216
         case TIMER0A:
10217 10217
         case TIMER0B:
10218 10218
           // TCCR0B &= ~(_BV(CS00) | _BV(CS01) | _BV(CS02));
10219 10219
           // TCCR0B |= val;
10220 10220
           break;
10221 10221
       #endif
10222
-      #if defined(TCCR1A)
10222
+      #ifdef TCCR1A
10223 10223
         case TIMER1A:
10224 10224
         case TIMER1B:
10225 10225
           // TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12));
10226 10226
           // TCCR1B |= val;
10227 10227
           break;
10228 10228
       #endif
10229
-      #if defined(TCCR2)
10229
+      #ifdef TCCR2
10230 10230
         case TIMER2:
10231 10231
         case TIMER2:
10232 10232
           TCCR2 &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12));
10233 10233
           TCCR2 |= val;
10234 10234
           break;
10235 10235
       #endif
10236
-      #if defined(TCCR2A)
10236
+      #ifdef TCCR2A
10237 10237
         case TIMER2A:
10238 10238
         case TIMER2B:
10239 10239
           TCCR2B &= ~(_BV(CS20) | _BV(CS21) | _BV(CS22));
10240 10240
           TCCR2B |= val;
10241 10241
           break;
10242 10242
       #endif
10243
-      #if defined(TCCR3A)
10243
+      #ifdef TCCR3A
10244 10244
         case TIMER3A:
10245 10245
         case TIMER3B:
10246 10246
         case TIMER3C:
@@ -10248,7 +10248,7 @@ void prepare_move_to_destination() {
10248 10248
           TCCR3B |= val;
10249 10249
           break;
10250 10250
       #endif
10251
-      #if defined(TCCR4A)
10251
+      #ifdef TCCR4A
10252 10252
         case TIMER4A:
10253 10253
         case TIMER4B:
10254 10254
         case TIMER4C:
@@ -10256,7 +10256,7 @@ void prepare_move_to_destination() {
10256 10256
           TCCR4B |= val;
10257 10257
           break;
10258 10258
       #endif
10259
-      #if defined(TCCR5A)
10259
+      #ifdef TCCR5A
10260 10260
         case TIMER5A:
10261 10261
         case TIMER5B:
10262 10262
         case TIMER5C:

+ 8
- 8
Marlin/pinsDebug.h View File

@@ -700,7 +700,7 @@ static bool pwm_status(uint8_t pin) {
700 700
     #if defined(TCCR3A) && defined(COM3A1)
701 701
       PWM_CASE(3,A);
702 702
       PWM_CASE(3,B);
703
-      #if defined(COM3C1)
703
+      #ifdef COM3C1
704 704
         PWM_CASE(3,C);
705 705
       #endif
706 706
     #endif
@@ -829,14 +829,14 @@ static void pwm_details(uint8_t pin) {
829 829
         else if (TIMSK3 & (_BV(TOIE3) | _BV(ICIE3))) err_prob_interrupt();
830 830
         else can_be_used();
831 831
         break;
832
-      #if defined(COM3C1)
832
+      #ifdef COM3C1
833 833
       case TIMER3C:
834
-          TIMER_PREFIX(3,C,3);
835
-          if (WGM_TEST2) err_is_counter();
836
-          else if (TEST(TIMSK3, OCIE3C)) err_is_interrupt();
837
-          else if (TIMSK3 & (_BV(TOIE3) | _BV(ICIE3))) err_prob_interrupt();
838
-          else can_be_used();
839
-          break;
834
+        TIMER_PREFIX(3,C,3);
835
+        if (WGM_TEST2) err_is_counter();
836
+        else if (TEST(TIMSK3, OCIE3C)) err_is_interrupt();
837
+        else if (TIMSK3 & (_BV(TOIE3) | _BV(ICIE3))) err_prob_interrupt();
838
+        else can_be_used();
839
+        break;
840 840
       #endif
841 841
     #endif
842 842
 

+ 1
- 1
Marlin/pins_MELZI.h View File

@@ -26,7 +26,7 @@
26 26
 
27 27
 #define BOARD_NAME "Melzi"
28 28
 
29
-#if defined(__AVR_ATmega1284P__)
29
+#ifdef __AVR_ATmega1284P__
30 30
   #define LARGE_FLASH true
31 31
 #endif
32 32
 

+ 1
- 1
Marlin/pins_MELZI_MAKR3D.h View File

@@ -26,7 +26,7 @@
26 26
 
27 27
 #define BOARD_NAME "Melzi ATmega1284"
28 28
 
29
-#if defined(__AVR_ATmega1284P__)
29
+#ifdef __AVR_ATmega1284P__
30 30
   #define LARGE_FLASH true
31 31
 #endif
32 32
 

+ 1
- 1
Marlin/pins_SANGUINOLOLU_12.h View File

@@ -34,7 +34,7 @@
34 34
 
35 35
 #define BOARD_NAME "Sanguinololu 1.2"
36 36
 
37
-#if defined(__AVR_ATmega1284P__)
37
+#ifdef __AVR_ATmega1284P__
38 38
   #define LARGE_FLASH true
39 39
 #endif
40 40
 

+ 1
- 1
Marlin/pins_STB_11.h View File

@@ -26,7 +26,7 @@
26 26
 
27 27
 #define BOARD_NAME "STB V1.1"
28 28
 
29
-#if defined(__AVR_ATmega1284P__)
29
+#ifdef __AVR_ATmega1284P__
30 30
   #define LARGE_FLASH true
31 31
 #endif
32 32
 

+ 1
- 1
Marlin/planner.cpp View File

@@ -455,7 +455,7 @@ void Planner::check_axes_activity() {
455 455
 
456 456
   #if FAN_COUNT > 0
457 457
 
458
-    #if defined(FAN_MIN_PWM)
458
+    #ifdef FAN_MIN_PWM
459 459
       #define CALC_FAN_SPEED(f) (tail_fan_speed[f] ? ( FAN_MIN_PWM + (tail_fan_speed[f] * (255 - FAN_MIN_PWM)) / 255 ) : 0)
460 460
     #else
461 461
       #define CALC_FAN_SPEED(f) tail_fan_speed[f]

+ 1
- 1
Marlin/ultralcd_impl_HD44780.h View File

@@ -161,7 +161,7 @@ extern volatile uint8_t buttons;  //an extended version of the last checked butt
161 161
   #include <LCD.h>
162 162
   #include <LiquidCrystal_SR.h>
163 163
   #define LCD_CLASS LiquidCrystal_SR
164
-  #if defined(SR_STROBE_PIN)
164
+  #if PIN_EXISTS(SR_STROBE)
165 165
     LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN, SR_STROBE_PIN);
166 166
   #else
167 167
     LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN);

Loading…
Cancel
Save