Browse Source

Use _BV macros, patch up others

Scott Lahteine 8 years ago
parent
commit
ff13070b59

+ 6
- 6
Marlin/Marlin.h View File

217
  * Debug flags - not yet widely applied
217
  * Debug flags - not yet widely applied
218
  */
218
  */
219
 enum DebugFlags {
219
 enum DebugFlags {
220
-  DEBUG_ECHO          = BIT(0),
221
-  DEBUG_INFO          = BIT(1),
222
-  DEBUG_ERRORS        = BIT(2),
223
-  DEBUG_DRYRUN        = BIT(3),
224
-  DEBUG_COMMUNICATION = BIT(4),
225
-  DEBUG_LEVELING      = BIT(5)
220
+  DEBUG_ECHO          = _BV(0),
221
+  DEBUG_INFO          = _BV(1),
222
+  DEBUG_ERRORS        = _BV(2),
223
+  DEBUG_DRYRUN        = _BV(3),
224
+  DEBUG_COMMUNICATION = _BV(4),
225
+  DEBUG_LEVELING      = _BV(5)
226
 };
226
 };
227
 extern uint8_t marlin_debug_flags;
227
 extern uint8_t marlin_debug_flags;
228
 
228
 

+ 1
- 1
Marlin/MarlinSerial.cpp View File

79
   #endif
79
   #endif
80
 
80
 
81
   if (useU2X) {
81
   if (useU2X) {
82
-    M_UCSRxA = BIT(M_U2Xx);
82
+    M_UCSRxA = _BV(M_U2Xx);
83
     baud_setting = (F_CPU / 4 / baud - 1) / 2;
83
     baud_setting = (F_CPU / 4 / baud - 1) / 2;
84
   }
84
   }
85
   else {
85
   else {

+ 10
- 10
Marlin/Marlin_main.cpp View File

1608
 
1608
 
1609
   enum ProbeAction {
1609
   enum ProbeAction {
1610
     ProbeStay          = 0,
1610
     ProbeStay          = 0,
1611
-    ProbeDeploy        = BIT(0),
1612
-    ProbeStow          = BIT(1),
1611
+    ProbeDeploy        = _BV(0),
1612
+    ProbeStow          = _BV(1),
1613
     ProbeDeployAndStow = (ProbeDeploy | ProbeStow)
1613
     ProbeDeployAndStow = (ProbeDeploy | ProbeStow)
1614
   };
1614
   };
1615
 
1615
 
6461
     return;
6461
     return;
6462
   }
6462
   }
6463
   float nx, ny, ne, normalized_dist;
6463
   float nx, ny, ne, normalized_dist;
6464
-  if (ix > pix && (x_splits) & BIT(ix)) {
6464
+  if (ix > pix && TEST(x_splits, ix)) {
6465
     nx = mbl.get_x(ix);
6465
     nx = mbl.get_x(ix);
6466
     normalized_dist = (nx - current_position[X_AXIS]) / (x - current_position[X_AXIS]);
6466
     normalized_dist = (nx - current_position[X_AXIS]) / (x - current_position[X_AXIS]);
6467
     ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
6467
     ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
6468
     ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
6468
     ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
6469
-    x_splits ^= BIT(ix);
6469
+    CBI(x_splits, ix);
6470
   }
6470
   }
6471
-  else if (ix < pix && (x_splits) & BIT(pix)) {
6471
+  else if (ix < pix && TEST(x_splits, pix)) {
6472
     nx = mbl.get_x(pix);
6472
     nx = mbl.get_x(pix);
6473
     normalized_dist = (nx - current_position[X_AXIS]) / (x - current_position[X_AXIS]);
6473
     normalized_dist = (nx - current_position[X_AXIS]) / (x - current_position[X_AXIS]);
6474
     ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
6474
     ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
6475
     ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
6475
     ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
6476
-    x_splits ^= BIT(pix);
6476
+    CBI(x_splits, pix);
6477
   }
6477
   }
6478
-  else if (iy > piy && (y_splits) & BIT(iy)) {
6478
+  else if (iy > piy && TEST(y_splits, iy)) {
6479
     ny = mbl.get_y(iy);
6479
     ny = mbl.get_y(iy);
6480
     normalized_dist = (ny - current_position[Y_AXIS]) / (y - current_position[Y_AXIS]);
6480
     normalized_dist = (ny - current_position[Y_AXIS]) / (y - current_position[Y_AXIS]);
6481
     nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
6481
     nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
6482
     ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
6482
     ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
6483
-    y_splits ^= BIT(iy);
6483
+    CBI(y_splits, iy);
6484
   }
6484
   }
6485
-  else if (iy < piy && (y_splits) & BIT(piy)) {
6485
+  else if (iy < piy && TEST(y_splits, piy)) {
6486
     ny = mbl.get_y(piy);
6486
     ny = mbl.get_y(piy);
6487
     normalized_dist = (ny - current_position[Y_AXIS]) / (y - current_position[Y_AXIS]);
6487
     normalized_dist = (ny - current_position[Y_AXIS]) / (y - current_position[Y_AXIS]);
6488
     nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
6488
     nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
6489
     ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
6489
     ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
6490
-    y_splits ^= BIT(piy);
6490
+    CBI(y_splits, piy);
6491
   }
6491
   }
6492
   else {
6492
   else {
6493
     // Already split on a border
6493
     // Already split on a border

+ 2
- 2
Marlin/Sd2Card.cpp View File

35
    */
35
    */
36
   static void spiInit(uint8_t spiRate) {
36
   static void spiInit(uint8_t spiRate) {
37
     // See avr processor documentation
37
     // See avr processor documentation
38
-    SPCR = BIT(SPE) | BIT(MSTR) | (spiRate >> 1);
39
-    SPSR = spiRate & 1 || spiRate == 6 ? 0 : BIT(SPI2X);
38
+    SPCR = _BV(SPE) | _BV(MSTR) | (spiRate >> 1);
39
+    SPSR = spiRate & 1 || spiRate == 6 ? 0 : _BV(SPI2X);
40
   }
40
   }
41
   //------------------------------------------------------------------------------
41
   //------------------------------------------------------------------------------
42
   /** SPI receive a byte */
42
   /** SPI receive a byte */

+ 4
- 4
Marlin/Sd2PinMap.h View File

405
   void setPinMode(uint8_t pin, uint8_t mode) {
405
   void setPinMode(uint8_t pin, uint8_t mode) {
406
   if (__builtin_constant_p(pin) && pin < digitalPinCount) {
406
   if (__builtin_constant_p(pin) && pin < digitalPinCount) {
407
     if (mode) {
407
     if (mode) {
408
-      *digitalPinMap[pin].ddr |= BIT(digitalPinMap[pin].bit);
408
+      SBI(*digitalPinMap[pin].ddr, digitalPinMap[pin].bit);
409
     }
409
     }
410
     else {
410
     else {
411
-      *digitalPinMap[pin].ddr &= ~BIT(digitalPinMap[pin].bit);
411
+      CBI(*digitalPinMap[pin].ddr, digitalPinMap[pin].bit);
412
     }
412
     }
413
   }
413
   }
414
   else {
414
   else {
428
   void fastDigitalWrite(uint8_t pin, uint8_t value) {
428
   void fastDigitalWrite(uint8_t pin, uint8_t value) {
429
   if (__builtin_constant_p(pin) && pin < digitalPinCount) {
429
   if (__builtin_constant_p(pin) && pin < digitalPinCount) {
430
     if (value) {
430
     if (value) {
431
-      *digitalPinMap[pin].port |= BIT(digitalPinMap[pin].bit);
431
+      SBI(*digitalPinMap[pin].port, digitalPinMap[pin].bit);
432
     }
432
     }
433
     else {
433
     else {
434
-      *digitalPinMap[pin].port &= ~BIT(digitalPinMap[pin].bit);
434
+      CBI(*digitalPinMap[pin].port, digitalPinMap[pin].bit);
435
     }
435
     }
436
   }
436
   }
437
   else {
437
   else {

+ 1
- 1
Marlin/SdVolume.cpp View File

364
   blocksPerCluster_ = fbs->sectorsPerCluster;
364
   blocksPerCluster_ = fbs->sectorsPerCluster;
365
   // determine shift that is same as multiply by blocksPerCluster_
365
   // determine shift that is same as multiply by blocksPerCluster_
366
   clusterSizeShift_ = 0;
366
   clusterSizeShift_ = 0;
367
-  while (blocksPerCluster_ != BIT(clusterSizeShift_)) {
367
+  while (blocksPerCluster_ != _BV(clusterSizeShift_)) {
368
     // error if not power of 2
368
     // error if not power of 2
369
     if (clusterSizeShift_++ > 7) goto fail;
369
     if (clusterSizeShift_++ > 7) goto fail;
370
   }
370
   }

+ 3
- 3
Marlin/dogm_lcd_implementation.h View File

22
   #define BLEN_A 0
22
   #define BLEN_A 0
23
   #define BLEN_B 1
23
   #define BLEN_B 1
24
   #define BLEN_C 2
24
   #define BLEN_C 2
25
-  #define EN_A BIT(BLEN_A)
26
-  #define EN_B BIT(BLEN_B)
27
-  #define EN_C BIT(BLEN_C)
25
+  #define EN_A (_BV(BLEN_A))
26
+  #define EN_B (_BV(BLEN_B))
27
+  #define EN_C (_BV(BLEN_C))
28
   #define LCD_CLICKED (buttons&EN_C)
28
   #define LCD_CLICKED (buttons&EN_C)
29
 #endif
29
 #endif
30
 
30
 

+ 16
- 16
Marlin/planner.cpp View File

580
   // Compute direction bits for this block
580
   // Compute direction bits for this block
581
   uint8_t db = 0;
581
   uint8_t db = 0;
582
   #if ENABLED(COREXY)
582
   #if ENABLED(COREXY)
583
-    if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
584
-    if (dy < 0) db |= BIT(Y_HEAD); // ...and Y
585
-    if (dz < 0) db |= BIT(Z_AXIS);
586
-    if (dx + dy < 0) db |= BIT(A_AXIS); // Motor A direction
587
-    if (dx - dy < 0) db |= BIT(B_AXIS); // Motor B direction
583
+    if (dx < 0) SBI(db, X_HEAD); // Save the real Extruder (head) direction in X Axis
584
+    if (dy < 0) SBI(db, Y_HEAD); // ...and Y
585
+    if (dz < 0) SBI(db, Z_AXIS);
586
+    if (dx + dy < 0) SBI(db, A_AXIS); // Motor A direction
587
+    if (dx - dy < 0) SBI(db, B_AXIS); // Motor B direction
588
   #elif ENABLED(COREXZ)
588
   #elif ENABLED(COREXZ)
589
-    if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
590
-    if (dy < 0) db |= BIT(Y_AXIS);
591
-    if (dz < 0) db |= BIT(Z_HEAD); // ...and Z
592
-    if (dx + dz < 0) db |= BIT(A_AXIS); // Motor A direction
593
-    if (dx - dz < 0) db |= BIT(C_AXIS); // Motor B direction
589
+    if (dx < 0) SBI(db, X_HEAD); // Save the real Extruder (head) direction in X Axis
590
+    if (dy < 0) SBI(db, Y_AXIS);
591
+    if (dz < 0) SBI(db, Z_HEAD); // ...and Z
592
+    if (dx + dz < 0) SBI(db, A_AXIS); // Motor A direction
593
+    if (dx - dz < 0) SBI(db, C_AXIS); // Motor B direction
594
   #else
594
   #else
595
-    if (dx < 0) db |= BIT(X_AXIS);
596
-    if (dy < 0) db |= BIT(Y_AXIS);
597
-    if (dz < 0) db |= BIT(Z_AXIS);
595
+    if (dx < 0) SBI(db, X_AXIS);
596
+    if (dy < 0) SBI(db, Y_AXIS);
597
+    if (dz < 0) SBI(db, Z_AXIS);
598
   #endif
598
   #endif
599
-  if (de < 0) db |= BIT(E_AXIS);
599
+  if (de < 0) SBI(db, E_AXIS);
600
   block->direction_bits = db;
600
   block->direction_bits = db;
601
 
601
 
602
   block->active_extruder = extruder;
602
   block->active_extruder = extruder;
824
          ys1 = axis_segment_time[Y_AXIS][1],
824
          ys1 = axis_segment_time[Y_AXIS][1],
825
          ys2 = axis_segment_time[Y_AXIS][2];
825
          ys2 = axis_segment_time[Y_AXIS][2];
826
 
826
 
827
-    if ((direction_change & BIT(X_AXIS)) != 0) {
827
+    if (TEST(direction_change, X_AXIS)) {
828
       xs2 = axis_segment_time[X_AXIS][2] = xs1;
828
       xs2 = axis_segment_time[X_AXIS][2] = xs1;
829
       xs1 = axis_segment_time[X_AXIS][1] = xs0;
829
       xs1 = axis_segment_time[X_AXIS][1] = xs0;
830
       xs0 = 0;
830
       xs0 = 0;
831
     }
831
     }
832
     xs0 = axis_segment_time[X_AXIS][0] = xs0 + segment_time;
832
     xs0 = axis_segment_time[X_AXIS][0] = xs0 + segment_time;
833
 
833
 
834
-    if ((direction_change & BIT(Y_AXIS)) != 0) {
834
+    if (TEST(direction_change, Y_AXIS)) {
835
       ys2 = axis_segment_time[Y_AXIS][2] = axis_segment_time[Y_AXIS][1];
835
       ys2 = axis_segment_time[Y_AXIS][2] = axis_segment_time[Y_AXIS][1];
836
       ys1 = axis_segment_time[Y_AXIS][1] = axis_segment_time[Y_AXIS][0];
836
       ys1 = axis_segment_time[Y_AXIS][1] = axis_segment_time[Y_AXIS][0];
837
       ys0 = 0;
837
       ys0 = 0;

+ 10
- 8
Marlin/servo.cpp View File

139
       TCCR1B = _BV(CS11);     // set prescaler of 8
139
       TCCR1B = _BV(CS11);     // set prescaler of 8
140
       TCNT1 = 0;              // clear the timer count
140
       TCNT1 = 0;              // clear the timer count
141
       #if defined(__AVR_ATmega8__)|| defined(__AVR_ATmega128__)
141
       #if defined(__AVR_ATmega8__)|| defined(__AVR_ATmega128__)
142
-        TIFR |= _BV(OCF1A);      // clear any pending interrupts;
143
-        TIMSK |= _BV(OCIE1A);    // enable the output compare interrupt
142
+        SBI(TIFR, OCF1A);      // clear any pending interrupts;
143
+        SBI(TIMSK, OCIE1A);    // enable the output compare interrupt
144
       #else
144
       #else
145
         // here if not ATmega8 or ATmega128
145
         // here if not ATmega8 or ATmega128
146
-        TIFR1 |= _BV(OCF1A);     // clear any pending interrupts;
147
-        TIMSK1 |= _BV(OCIE1A);   // enable the output compare interrupt
146
+        SBI(TIFR1, OCF1A);     // clear any pending interrupts;
147
+        SBI(TIMSK1, OCIE1A);   // enable the output compare interrupt
148
       #endif
148
       #endif
149
       #ifdef WIRING
149
       #ifdef WIRING
150
         timerAttach(TIMER1OUTCOMPAREA_INT, Timer1Service);
150
         timerAttach(TIMER1OUTCOMPAREA_INT, Timer1Service);
158
       TCCR3B = _BV(CS31);     // set prescaler of 8
158
       TCCR3B = _BV(CS31);     // set prescaler of 8
159
       TCNT3 = 0;              // clear the timer count
159
       TCNT3 = 0;              // clear the timer count
160
       #ifdef __AVR_ATmega128__
160
       #ifdef __AVR_ATmega128__
161
-        TIFR |= _BV(OCF3A);     // clear any pending interrupts;
162
-        ETIMSK |= _BV(OCIE3A);  // enable the output compare interrupt
161
+        SBI(TIFR, OCF3A);     // clear any pending interrupts;
162
+        SBI(ETIMSK, OCIE3A);  // enable the output compare interrupt
163
       #else
163
       #else
164
         TIFR3 = _BV(OCF3A);     // clear any pending interrupts;
164
         TIFR3 = _BV(OCF3A);     // clear any pending interrupts;
165
         TIMSK3 =  _BV(OCIE3A) ; // enable the output compare interrupt
165
         TIMSK3 =  _BV(OCIE3A) ; // enable the output compare interrupt
195
   // Disable use of the given timer
195
   // Disable use of the given timer
196
   #ifdef WIRING
196
   #ifdef WIRING
197
     if (timer == _timer1) {
197
     if (timer == _timer1) {
198
+      CBI(
198
       #if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
199
       #if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
199
         TIMSK1
200
         TIMSK1
200
       #else
201
       #else
201
         TIMSK
202
         TIMSK
202
       #endif
203
       #endif
203
-          &= ~_BV(OCIE1A);    // disable timer 1 output compare interrupt
204
+          , OCIE1A);    // disable timer 1 output compare interrupt
204
       timerDetach(TIMER1OUTCOMPAREA_INT);
205
       timerDetach(TIMER1OUTCOMPAREA_INT);
205
     }
206
     }
206
     else if (timer == _timer3) {
207
     else if (timer == _timer3) {
208
+      CBI(
207
       #if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
209
       #if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
208
         TIMSK3
210
         TIMSK3
209
       #else
211
       #else
210
         ETIMSK
212
         ETIMSK
211
       #endif
213
       #endif
212
-          &= ~_BV(OCIE3A);    // disable the timer3 output compare A interrupt
214
+          , OCIE3A);    // disable the timer3 output compare A interrupt
213
       timerDetach(TIMER3OUTCOMPAREA_INT);
215
       timerDetach(TIMER3OUTCOMPAREA_INT);
214
     }
216
     }
215
   #else //!WIRING
217
   #else //!WIRING

+ 18
- 18
Marlin/stepper.cpp View File

242
 
242
 
243
 // Some useful constants
243
 // Some useful constants
244
 
244
 
245
-#define ENABLE_STEPPER_DRIVER_INTERRUPT()  TIMSK1 |= BIT(OCIE1A)
246
-#define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~BIT(OCIE1A)
245
+#define ENABLE_STEPPER_DRIVER_INTERRUPT()  SBI(TIMSK1, OCIE1A)
246
+#define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
247
 
247
 
248
 void endstops_hit_on_purpose() {
248
 void endstops_hit_on_purpose() {
249
   endstop_hit_bits = 0;
249
   endstop_hit_bits = 0;
253
   if (endstop_hit_bits) {
253
   if (endstop_hit_bits) {
254
     SERIAL_ECHO_START;
254
     SERIAL_ECHO_START;
255
     SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
255
     SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
256
-    if (endstop_hit_bits & BIT(X_MIN)) {
256
+    if (TEST(endstop_hit_bits, X_MIN)) {
257
       SERIAL_ECHOPAIR(" X:", (float)endstops_trigsteps[X_AXIS] / axis_steps_per_unit[X_AXIS]);
257
       SERIAL_ECHOPAIR(" X:", (float)endstops_trigsteps[X_AXIS] / axis_steps_per_unit[X_AXIS]);
258
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "X");
258
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "X");
259
     }
259
     }
260
-    if (endstop_hit_bits & BIT(Y_MIN)) {
260
+    if (TEST(endstop_hit_bits, Y_MIN)) {
261
       SERIAL_ECHOPAIR(" Y:", (float)endstops_trigsteps[Y_AXIS] / axis_steps_per_unit[Y_AXIS]);
261
       SERIAL_ECHOPAIR(" Y:", (float)endstops_trigsteps[Y_AXIS] / axis_steps_per_unit[Y_AXIS]);
262
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Y");
262
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Y");
263
     }
263
     }
264
-    if (endstop_hit_bits & BIT(Z_MIN)) {
264
+    if (TEST(endstop_hit_bits, Z_MIN)) {
265
       SERIAL_ECHOPAIR(" Z:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
265
       SERIAL_ECHOPAIR(" Z:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
266
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
266
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
267
     }
267
     }
268
     #if ENABLED(Z_MIN_PROBE_ENDSTOP)
268
     #if ENABLED(Z_MIN_PROBE_ENDSTOP)
269
-      if (endstop_hit_bits & BIT(Z_MIN_PROBE)) {
269
+      if (TEST(endstop_hit_bits, Z_MIN_PROBE)) {
270
         SERIAL_ECHOPAIR(" Z_MIN_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
270
         SERIAL_ECHOPAIR(" Z_MIN_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
271
         LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
271
         LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
272
       }
272
       }
309
   #define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
309
   #define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
310
   #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
310
   #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
311
   #define _AXIS(AXIS) AXIS ##_AXIS
311
   #define _AXIS(AXIS) AXIS ##_AXIS
312
-  #define _ENDSTOP_HIT(AXIS) endstop_hit_bits |= BIT(_ENDSTOP(AXIS, MIN))
312
+  #define _ENDSTOP_HIT(AXIS) SBI(endstop_hit_bits, _ENDSTOP(AXIS, MIN))
313
   #define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
313
   #define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
314
 
314
 
315
   // SET_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
315
   // SET_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
424
 
424
 
425
             if (z_test && current_block->steps[Z_AXIS] > 0) { // z_test = Z_MIN || Z2_MIN
425
             if (z_test && current_block->steps[Z_AXIS] > 0) { // z_test = Z_MIN || Z2_MIN
426
               endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
426
               endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
427
-              endstop_hit_bits |= BIT(Z_MIN);
427
+              SBI(endstop_hit_bits, Z_MIN);
428
               if (!performing_homing || (z_test == 0x3))  //if not performing home or if both endstops were trigged during homing...
428
               if (!performing_homing || (z_test == 0x3))  //if not performing home or if both endstops were trigged during homing...
429
                 step_events_completed = current_block->step_event_count;
429
                 step_events_completed = current_block->step_event_count;
430
             }
430
             }
440
 
440
 
441
           if (TEST_ENDSTOP(Z_MIN_PROBE)) {
441
           if (TEST_ENDSTOP(Z_MIN_PROBE)) {
442
             endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
442
             endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
443
-            endstop_hit_bits |= BIT(Z_MIN_PROBE);
443
+            SBI(endstop_hit_bits, Z_MIN_PROBE);
444
           }
444
           }
445
         #endif
445
         #endif
446
       }
446
       }
460
 
460
 
461
             if (z_test && current_block->steps[Z_AXIS] > 0) {  // t_test = Z_MAX || Z2_MAX
461
             if (z_test && current_block->steps[Z_AXIS] > 0) {  // t_test = Z_MAX || Z2_MAX
462
               endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
462
               endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
463
-              endstop_hit_bits |= BIT(Z_MIN);
463
+              SBI(endstop_hit_bits, Z_MIN);
464
               if (!performing_homing || (z_test == 0x3))  //if not performing home or if both endstops were trigged during homing...
464
               if (!performing_homing || (z_test == 0x3))  //if not performing home or if both endstops were trigged during homing...
465
                 step_events_completed = current_block->step_event_count;
465
                 step_events_completed = current_block->step_event_count;
466
             }
466
             }
963
       WRITE(Z_MIN_PIN,HIGH);
963
       WRITE(Z_MIN_PIN,HIGH);
964
     #endif
964
     #endif
965
   #endif
965
   #endif
966
-  
966
+
967
   #if HAS_Z2_MIN
967
   #if HAS_Z2_MIN
968
     SET_INPUT(Z2_MIN_PIN);
968
     SET_INPUT(Z2_MIN_PIN);
969
     #if ENABLED(ENDSTOPPULLUP_ZMIN)
969
     #if ENABLED(ENDSTOPPULLUP_ZMIN)
1052
   #endif
1052
   #endif
1053
 
1053
 
1054
   // waveform generation = 0100 = CTC
1054
   // waveform generation = 0100 = CTC
1055
-  TCCR1B &= ~BIT(WGM13);
1056
-  TCCR1B |=  BIT(WGM12);
1057
-  TCCR1A &= ~BIT(WGM11);
1058
-  TCCR1A &= ~BIT(WGM10);
1055
+  CBI(TCCR1B, WGM13);
1056
+  SBI(TCCR1B, WGM12);
1057
+  CBI(TCCR1A, WGM11);
1058
+  CBI(TCCR1A, WGM10);
1059
 
1059
 
1060
   // output mode = 00 (disconnected)
1060
   // output mode = 00 (disconnected)
1061
   TCCR1A &= ~(3 << COM1A0);
1061
   TCCR1A &= ~(3 << COM1A0);
1073
 
1073
 
1074
   #if ENABLED(ADVANCE)
1074
   #if ENABLED(ADVANCE)
1075
     #if defined(TCCR0A) && defined(WGM01)
1075
     #if defined(TCCR0A) && defined(WGM01)
1076
-      TCCR0A &= ~BIT(WGM01);
1077
-      TCCR0A &= ~BIT(WGM00);
1076
+      CBI(TCCR0A, WGM01);
1077
+      CBI(TCCR0A, WGM00);
1078
     #endif
1078
     #endif
1079
     e_steps[0] = e_steps[1] = e_steps[2] = e_steps[3] = 0;
1079
     e_steps[0] = e_steps[1] = e_steps[2] = e_steps[3] = 0;
1080
-    TIMSK0 |= BIT(OCIE0A);
1080
+    SBI(TIMSK0, OCIE0A);
1081
   #endif //ADVANCE
1081
   #endif //ADVANCE
1082
 
1082
 
1083
   enable_endstops(true); // Start with endstops active. After homing they can be disabled
1083
   enable_endstops(true); // Start with endstops active. After homing they can be disabled

+ 21
- 20
Marlin/temperature.cpp View File

850
 void tp_init() {
850
 void tp_init() {
851
   #if MB(RUMBA) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
851
   #if MB(RUMBA) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
852
     //disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
852
     //disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
853
-    MCUCR = BIT(JTD);
854
-    MCUCR = BIT(JTD);
853
+    MCUCR = _BV(JTD);
854
+    MCUCR = _BV(JTD);
855
   #endif
855
   #endif
856
 
856
 
857
   // Finish init of mult extruder arrays
857
   // Finish init of mult extruder arrays
914
   #endif //HEATER_0_USES_MAX6675
914
   #endif //HEATER_0_USES_MAX6675
915
 
915
 
916
   #ifdef DIDR2
916
   #ifdef DIDR2
917
-    #define ANALOG_SELECT(pin) do{ if (pin < 8) DIDR0 |= BIT(pin); else DIDR2 |= BIT(pin - 8); }while(0)
917
+    #define ANALOG_SELECT(pin) do{ if (pin < 8) SBI(DIDR0, pin); else SBI(DIDR2, pin - 8); }while(0)
918
   #else
918
   #else
919
-    #define ANALOG_SELECT(pin) do{ DIDR0 |= BIT(pin); }while(0)
919
+    #define ANALOG_SELECT(pin) do{ SBI(DIDR0, pin); }while(0)
920
   #endif
920
   #endif
921
 
921
 
922
   // Set analog inputs
922
   // Set analog inputs
923
-  ADCSRA = BIT(ADEN) | BIT(ADSC) | BIT(ADIF) | 0x07;
923
+  ADCSRA = _BV(ADEN) | _BV(ADSC) | _BV(ADIF) | 0x07;
924
   DIDR0 = 0;
924
   DIDR0 = 0;
925
   #ifdef DIDR2
925
   #ifdef DIDR2
926
     DIDR2 = 0;
926
     DIDR2 = 0;
960
   // Use timer0 for temperature measurement
960
   // Use timer0 for temperature measurement
961
   // Interleave temperature interrupt with millies interrupt
961
   // Interleave temperature interrupt with millies interrupt
962
   OCR0B = 128;
962
   OCR0B = 128;
963
-  TIMSK0 |= BIT(OCIE0B);
963
+  SBI(TIMSK0, OCIE0B);
964
 
964
 
965
   // Wait for temperature measurement to settle
965
   // Wait for temperature measurement to settle
966
   delay(250);
966
   delay(250);
1160
 
1160
 
1161
     max6675_temp = 0;
1161
     max6675_temp = 0;
1162
 
1162
 
1163
-    #ifdef PRR
1164
-      PRR &= ~BIT(PRSPI);
1165
-    #elif defined(PRR0)
1166
-      PRR0 &= ~BIT(PRSPI);
1167
-    #endif
1168
-
1169
-    SPCR = BIT(MSTR) | BIT(SPE) | BIT(SPR0);
1163
+    CBI(
1164
+      #ifdef PRR
1165
+        PRR
1166
+      #elif defined(PRR0)
1167
+        PRR0
1168
+      #endif
1169
+        , PRSPI);
1170
+    SPCR = _BV(MSTR) | _BV(SPE) | _BV(SPR0);
1170
 
1171
 
1171
     // enable TT_MAX6675
1172
     // enable TT_MAX6675
1172
     WRITE(MAX6675_SS, 0);
1173
     WRITE(MAX6675_SS, 0);
1177
 
1178
 
1178
     // read MSB
1179
     // read MSB
1179
     SPDR = 0;
1180
     SPDR = 0;
1180
-    for (; (SPSR & BIT(SPIF)) == 0;);
1181
+    for (; !TEST(SPSR, SPIF););
1181
     max6675_temp = SPDR;
1182
     max6675_temp = SPDR;
1182
     max6675_temp <<= 8;
1183
     max6675_temp <<= 8;
1183
 
1184
 
1184
     // read LSB
1185
     // read LSB
1185
     SPDR = 0;
1186
     SPDR = 0;
1186
-    for (; (SPSR & BIT(SPIF)) == 0;);
1187
+    for (; !TEST(SPSR, SPIF););
1187
     max6675_temp |= SPDR;
1188
     max6675_temp |= SPDR;
1188
 
1189
 
1189
     // disable TT_MAX6675
1190
     // disable TT_MAX6675
1256
 
1257
 
1257
   static unsigned char temp_count = 0;
1258
   static unsigned char temp_count = 0;
1258
   static TempState temp_state = StartupDelay;
1259
   static TempState temp_state = StartupDelay;
1259
-  static unsigned char pwm_count = BIT(SOFT_PWM_SCALE);
1260
+  static unsigned char pwm_count = _BV(SOFT_PWM_SCALE);
1260
 
1261
 
1261
   // Static members for each heater
1262
   // Static members for each heater
1262
   #if ENABLED(SLOW_PWM_HEATERS)
1263
   #if ENABLED(SLOW_PWM_HEATERS)
1341
       if (soft_pwm_fan < pwm_count) WRITE_FAN(0);
1342
       if (soft_pwm_fan < pwm_count) WRITE_FAN(0);
1342
     #endif
1343
     #endif
1343
 
1344
 
1344
-    pwm_count += BIT(SOFT_PWM_SCALE);
1345
+    pwm_count += _BV(SOFT_PWM_SCALE);
1345
     pwm_count &= 0x7f;
1346
     pwm_count &= 0x7f;
1346
 
1347
 
1347
   #else // SLOW_PWM_HEATERS
1348
   #else // SLOW_PWM_HEATERS
1423
       if (soft_pwm_fan < pwm_count) WRITE_FAN(0);
1424
       if (soft_pwm_fan < pwm_count) WRITE_FAN(0);
1424
     #endif //FAN_SOFT_PWM
1425
     #endif //FAN_SOFT_PWM
1425
 
1426
 
1426
-    pwm_count += BIT(SOFT_PWM_SCALE);
1427
+    pwm_count += _BV(SOFT_PWM_SCALE);
1427
     pwm_count &= 0x7f;
1428
     pwm_count &= 0x7f;
1428
 
1429
 
1429
     // increment slow_pwm_count only every 64 pwm_count circa 65.5ms
1430
     // increment slow_pwm_count only every 64 pwm_count circa 65.5ms
1449
 
1450
 
1450
   #endif // SLOW_PWM_HEATERS
1451
   #endif // SLOW_PWM_HEATERS
1451
 
1452
 
1452
-  #define SET_ADMUX_ADCSRA(pin) ADMUX = BIT(REFS0) | (pin & 0x07); ADCSRA |= BIT(ADSC)
1453
+  #define SET_ADMUX_ADCSRA(pin) ADMUX = _BV(REFS0) | (pin & 0x07); SBI(ADCSRA, ADSC)
1453
   #ifdef MUX5
1454
   #ifdef MUX5
1454
-    #define START_ADC(pin) if (pin > 7) ADCSRB = BIT(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
1455
+    #define START_ADC(pin) if (pin > 7) ADCSRB = _BV(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
1455
   #else
1456
   #else
1456
     #define START_ADC(pin) ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
1457
     #define START_ADC(pin) ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
1457
   #endif
1458
   #endif

+ 2
- 2
Marlin/ultralcd.cpp View File

1911
         WRITE(SHIFT_LD, HIGH);
1911
         WRITE(SHIFT_LD, HIGH);
1912
         for (int8_t i = 0; i < 8; i++) {
1912
         for (int8_t i = 0; i < 8; i++) {
1913
           newbutton_reprapworld_keypad >>= 1;
1913
           newbutton_reprapworld_keypad >>= 1;
1914
-          if (READ(SHIFT_OUT)) newbutton_reprapworld_keypad |= BIT(7);
1914
+          if (READ(SHIFT_OUT)) SBI(newbutton_reprapworld_keypad, 7);
1915
           WRITE(SHIFT_CLK, HIGH);
1915
           WRITE(SHIFT_CLK, HIGH);
1916
           WRITE(SHIFT_CLK, LOW);
1916
           WRITE(SHIFT_CLK, LOW);
1917
         }
1917
         }
1924
       unsigned char tmp_buttons = 0;
1924
       unsigned char tmp_buttons = 0;
1925
       for (int8_t i = 0; i < 8; i++) {
1925
       for (int8_t i = 0; i < 8; i++) {
1926
         newbutton >>= 1;
1926
         newbutton >>= 1;
1927
-        if (READ(SHIFT_OUT)) newbutton |= BIT(7);
1927
+        if (READ(SHIFT_OUT)) SBI(newbutton, 7);
1928
         WRITE(SHIFT_CLK, HIGH);
1928
         WRITE(SHIFT_CLK, HIGH);
1929
         WRITE(SHIFT_CLK, LOW);
1929
         WRITE(SHIFT_CLK, LOW);
1930
       }
1930
       }

+ 19
- 19
Marlin/ultralcd.h View File

63
   void lcd_ignore_click(bool b=true);
63
   void lcd_ignore_click(bool b=true);
64
 
64
 
65
   #if ENABLED(NEWPANEL)
65
   #if ENABLED(NEWPANEL)
66
-    #define EN_C BIT(BLEN_C)
67
-    #define EN_B BIT(BLEN_B)
68
-    #define EN_A BIT(BLEN_A)
66
+    #define EN_C (_BV(BLEN_C))
67
+    #define EN_B (_BV(BLEN_B))
68
+    #define EN_A (_BV(BLEN_A))
69
 
69
 
70
     #if ENABLED(REPRAPWORLD_KEYPAD)
70
     #if ENABLED(REPRAPWORLD_KEYPAD)
71
-      #define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3))
72
-      #define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2))
73
-      #define EN_REPRAPWORLD_KEYPAD_F1 (BIT(BLEN_REPRAPWORLD_KEYPAD_F1))
74
-      #define EN_REPRAPWORLD_KEYPAD_UP (BIT(BLEN_REPRAPWORLD_KEYPAD_UP))
75
-      #define EN_REPRAPWORLD_KEYPAD_RIGHT (BIT(BLEN_REPRAPWORLD_KEYPAD_RIGHT))
76
-      #define EN_REPRAPWORLD_KEYPAD_MIDDLE (BIT(BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
77
-      #define EN_REPRAPWORLD_KEYPAD_DOWN (BIT(BLEN_REPRAPWORLD_KEYPAD_DOWN))
78
-      #define EN_REPRAPWORLD_KEYPAD_LEFT (BIT(BLEN_REPRAPWORLD_KEYPAD_LEFT))
71
+      #define EN_REPRAPWORLD_KEYPAD_F3 (_BV(BLEN_REPRAPWORLD_KEYPAD_F3))
72
+      #define EN_REPRAPWORLD_KEYPAD_F2 (_BV(BLEN_REPRAPWORLD_KEYPAD_F2))
73
+      #define EN_REPRAPWORLD_KEYPAD_F1 (_BV(BLEN_REPRAPWORLD_KEYPAD_F1))
74
+      #define EN_REPRAPWORLD_KEYPAD_UP (_BV(BLEN_REPRAPWORLD_KEYPAD_UP))
75
+      #define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(BLEN_REPRAPWORLD_KEYPAD_RIGHT))
76
+      #define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
77
+      #define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(BLEN_REPRAPWORLD_KEYPAD_DOWN))
78
+      #define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(BLEN_REPRAPWORLD_KEYPAD_LEFT))
79
 
79
 
80
       #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
80
       #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
81
       #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2)
81
       #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2)
90
     #endif //REPRAPWORLD_KEYPAD
90
     #endif //REPRAPWORLD_KEYPAD
91
   #else
91
   #else
92
     //atomic, do not change
92
     //atomic, do not change
93
-    #define B_LE BIT(BL_LE)
94
-    #define B_UP BIT(BL_UP)
95
-    #define B_MI BIT(BL_MI)
96
-    #define B_DW BIT(BL_DW)
97
-    #define B_RI BIT(BL_RI)
98
-    #define B_ST BIT(BL_ST)
99
-    #define EN_B BIT(BLEN_B)
100
-    #define EN_A BIT(BLEN_A)
93
+    #define B_LE (_BV(BL_LE))
94
+    #define B_UP (_BV(BL_UP))
95
+    #define B_MI (_BV(BL_MI))
96
+    #define B_DW (_BV(BL_DW))
97
+    #define B_RI (_BV(BL_RI))
98
+    #define B_ST (_BV(BL_ST))
99
+    #define EN_B (_BV(BLEN_B))
100
+    #define EN_A (_BV(BLEN_A))
101
 
101
 
102
     #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
102
     #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
103
   #endif//NEWPANEL
103
   #endif//NEWPANEL

+ 17
- 17
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

20
   #define BLEN_B 1
20
   #define BLEN_B 1
21
   #define BLEN_A 0
21
   #define BLEN_A 0
22
 
22
 
23
-  #define EN_B BIT(BLEN_B) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
24
-  #define EN_A BIT(BLEN_A)
23
+  #define EN_B (_BV(BLEN_B)) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
24
+  #define EN_A (_BV(BLEN_A))
25
 
25
 
26
   #if defined(BTN_ENC) && BTN_ENC > -1
26
   #if defined(BTN_ENC) && BTN_ENC > -1
27
     // encoder click is directly connected
27
     // encoder click is directly connected
28
     #define BLEN_C 2
28
     #define BLEN_C 2
29
-    #define EN_C BIT(BLEN_C)
29
+    #define EN_C (_BV(BLEN_C))
30
   #endif
30
   #endif
31
 
31
 
32
   //
32
   //
85
 
85
 
86
     #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
86
     #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
87
 
87
 
88
-    #define EN_REPRAPWORLD_KEYPAD_F3 BIT((BLEN_REPRAPWORLD_KEYPAD_F3+REPRAPWORLD_BTN_OFFSET))
89
-    #define EN_REPRAPWORLD_KEYPAD_F2 BIT((BLEN_REPRAPWORLD_KEYPAD_F2+REPRAPWORLD_BTN_OFFSET))
90
-    #define EN_REPRAPWORLD_KEYPAD_F1 BIT((BLEN_REPRAPWORLD_KEYPAD_F1+REPRAPWORLD_BTN_OFFSET))
91
-    #define EN_REPRAPWORLD_KEYPAD_UP BIT((BLEN_REPRAPWORLD_KEYPAD_UP+REPRAPWORLD_BTN_OFFSET))
92
-    #define EN_REPRAPWORLD_KEYPAD_RIGHT BIT((BLEN_REPRAPWORLD_KEYPAD_RIGHT+REPRAPWORLD_BTN_OFFSET))
93
-    #define EN_REPRAPWORLD_KEYPAD_MIDDLE BIT((BLEN_REPRAPWORLD_KEYPAD_MIDDLE+REPRAPWORLD_BTN_OFFSET))
94
-    #define EN_REPRAPWORLD_KEYPAD_DOWN BIT((BLEN_REPRAPWORLD_KEYPAD_DOWN+REPRAPWORLD_BTN_OFFSET))
95
-    #define EN_REPRAPWORLD_KEYPAD_LEFT BIT((BLEN_REPRAPWORLD_KEYPAD_LEFT+REPRAPWORLD_BTN_OFFSET))
88
+    #define EN_REPRAPWORLD_KEYPAD_F3 (_BV(BLEN_REPRAPWORLD_KEYPAD_F3+REPRAPWORLD_BTN_OFFSET))
89
+    #define EN_REPRAPWORLD_KEYPAD_F2 (_BV(BLEN_REPRAPWORLD_KEYPAD_F2+REPRAPWORLD_BTN_OFFSET))
90
+    #define EN_REPRAPWORLD_KEYPAD_F1 (_BV(BLEN_REPRAPWORLD_KEYPAD_F1+REPRAPWORLD_BTN_OFFSET))
91
+    #define EN_REPRAPWORLD_KEYPAD_UP (_BV(BLEN_REPRAPWORLD_KEYPAD_UP+REPRAPWORLD_BTN_OFFSET))
92
+    #define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(BLEN_REPRAPWORLD_KEYPAD_RIGHT+REPRAPWORLD_BTN_OFFSET))
93
+    #define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(BLEN_REPRAPWORLD_KEYPAD_MIDDLE+REPRAPWORLD_BTN_OFFSET))
94
+    #define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(BLEN_REPRAPWORLD_KEYPAD_DOWN+REPRAPWORLD_BTN_OFFSET))
95
+    #define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(BLEN_REPRAPWORLD_KEYPAD_LEFT+REPRAPWORLD_BTN_OFFSET))
96
 
96
 
97
     //#define LCD_CLICKED ((buttons&EN_C) || (buttons&EN_REPRAPWORLD_KEYPAD_F1))
97
     //#define LCD_CLICKED ((buttons&EN_C) || (buttons&EN_REPRAPWORLD_KEYPAD_F1))
98
     //#define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons&EN_REPRAPWORLD_KEYPAD_DOWN)
98
     //#define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons&EN_REPRAPWORLD_KEYPAD_DOWN)
113
     #define BL_ST 2
113
     #define BL_ST 2
114
 
114
 
115
     //automatic, do not change
115
     //automatic, do not change
116
-    #define B_LE BIT(BL_LE)
117
-    #define B_UP BIT(BL_UP)
118
-    #define B_MI BIT(BL_MI)
119
-    #define B_DW BIT(BL_DW)
120
-    #define B_RI BIT(BL_RI)
121
-    #define B_ST BIT(BL_ST)
116
+    #define B_LE (_BV(BL_LE))
117
+    #define B_UP (_BV(BL_UP))
118
+    #define B_MI (_BV(BL_MI))
119
+    #define B_DW (_BV(BL_DW))
120
+    #define B_RI (_BV(BL_RI))
121
+    #define B_ST (_BV(BL_ST))
122
 
122
 
123
     #define LCD_CLICKED (buttons&(B_MI|B_ST))
123
     #define LCD_CLICKED (buttons&(B_MI|B_ST))
124
   #endif
124
   #endif

Loading…
Cancel
Save