Browse Source

Improve bitWrite macro

teensy4-core
PaulStoffregen 8 years ago
parent
commit
2b24e39e13
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      teensy/wiring.h
  2. +1
    -1
      teensy3/wiring.h

+ 1
- 1
teensy/wiring.h View File

@@ -87,7 +87,7 @@ extern "C"{
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet((value), (bit)) : bitClear((value), (bit)))

typedef unsigned int word;


+ 1
- 1
teensy3/wiring.h View File

@@ -109,7 +109,7 @@ extern "C"{
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet((value), (bit)) : bitClear((value), (bit)))

typedef unsigned int word;


Loading…
Cancel
Save