Browse Source

Simplified SET_BIT, moved to endstops.cpp

Scott Lahteine 7 years ago
parent
commit
c251601916
2 changed files with 1 additions and 1 deletions
  1. 0
    1
      Marlin/src/core/macros.h
  2. 1
    0
      Marlin/src/module/endstops.cpp

+ 0
- 1
Marlin/src/core/macros.h View File

100
 #define TEST(n,b) !!((n)&_BV(b))
100
 #define TEST(n,b) !!((n)&_BV(b))
101
 #define SBI(n,b) (n |= _BV(b))
101
 #define SBI(n,b) (n |= _BV(b))
102
 #define CBI(n,b) (n &= ~_BV(b))
102
 #define CBI(n,b) (n &= ~_BV(b))
103
-#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b))
104
 
103
 
105
 #define _BV32(b) (1UL << (b))
104
 #define _BV32(b) (1UL << (b))
106
 #define TEST32(n,b) !!((n)&_BV32(b))
105
 #define TEST32(n,b) !!((n)&_BV32(b))

+ 1
- 0
Marlin/src/module/endstops.cpp View File

317
   #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
317
   #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
318
   #define _ENDSTOP_HIT(AXIS, MINMAX) SBI(endstop_hit_bits, _ENDSTOP(AXIS, MINMAX))
318
   #define _ENDSTOP_HIT(AXIS, MINMAX) SBI(endstop_hit_bits, _ENDSTOP(AXIS, MINMAX))
319
 
319
 
320
+  #define SET_BIT(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0)
320
   // UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
321
   // UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
321
   #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT(current_endstop_bits, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
322
   #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT(current_endstop_bits, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
322
   // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST
323
   // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST

Loading…
Cancel
Save