Move SET_BIT macro to endstops.cpp and simplify

This commit is contained in:
Scott Lahteine 2018-02-02 00:40:22 -06:00
parent 0a10d010b7
commit f4639fa964
2 changed files with 1 additions and 1 deletions

View File

@ -306,6 +306,7 @@ void Endstops::update() {
#define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
#define _ENDSTOP_HIT(AXIS, MINMAX) SBI(endstop_hit_bits, _ENDSTOP(AXIS, MINMAX)) #define _ENDSTOP_HIT(AXIS, MINMAX) SBI(endstop_hit_bits, _ENDSTOP(AXIS, MINMAX))
#define SET_BIT(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0)
// UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status // UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
#define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT(current_endstop_bits, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX))) #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT(current_endstop_bits, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
// COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST

View File

@ -106,7 +106,6 @@
#define TEST(n,b) !!((n)&_BV(b)) #define TEST(n,b) !!((n)&_BV(b))
#define SBI(n,b) (n |= _BV(b)) #define SBI(n,b) (n |= _BV(b))
#define CBI(n,b) (n &= ~_BV(b)) #define CBI(n,b) (n &= ~_BV(b))
#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b))
#define _BV32(b) (1UL << (b)) #define _BV32(b) (1UL << (b))
#define TEST32(n,b) !!((n)&_BV32(b)) #define TEST32(n,b) !!((n)&_BV32(b))