Isolate atomic bit flag for execution.
- Denoted bit_true_atomic only for sys.execute bit settings. All other bit_true type calls are for local variables only and don’t need atomic access. Still looking into other ways of setting these flags without requiring atomic access, but this is a patch for now.
This commit is contained in:
@ -44,9 +44,11 @@
|
||||
|
||||
// Bit field and masking macros
|
||||
#define bit(n) (1 << n)
|
||||
#define bit_true(x,mask) {uint8_t sreg = SREG; cli(); (x) |= (mask); SREG = sreg; }
|
||||
#define bit_false(x,mask) {uint8_t sreg = SREG; cli(); (x) &= ~(mask); SREG = sreg; }
|
||||
#define bit_toggle(x,mask) {uint8_t sreg = SREG; cli(); (x) ^= (mask); SREG = sreg; }
|
||||
#define bit_true_atomic(x,mask) {uint8_t sreg = SREG; cli(); (x) |= (mask); SREG = sreg; }
|
||||
#define bit_false_atomic(x,mask) {uint8_t sreg = SREG; cli(); (x) &= ~(mask); SREG = sreg; }
|
||||
#define bit_toggle_atomic(x,mask) {uint8_t sreg = SREG; cli(); (x) ^= (mask); SREG = sreg; }
|
||||
#define bit_true(x,mask) (x) |= (mask)
|
||||
#define bit_false(x,mask) (x) &= ~(mask)
|
||||
#define bit_istrue(x,mask) ((x & mask) != 0)
|
||||
#define bit_isfalse(x,mask) ((x & mask) == 0)
|
||||
|
||||
|
Reference in New Issue
Block a user