![]() |
Speeduino
|
Bit twiddling macros. More...

Go to the source code of this file.
Macros | |
| #define | BIT_SET(var, pos) ((var) |= (1U<<(pos))) |
| Set bit b (0-7) in byte a. | |
| #define | BIT_CLEAR(var, pos) ((var) &= ~(1U<<(pos))) |
| Clear bit b (0-7) in byte a. | |
| #define | BIT_CHECK(var, pos) !!((var) & (1U<<(pos))) |
| Is bit pos (0-7) in byte var set? | |
| #define | BIT_TOGGLE(var, pos) ((var)^= 1UL << (pos)) |
| Toggle the value of bit pos (0-7) in byte var. | |
| #define | BIT_WRITE(var, pos, bitvalue) ((bitvalue) ? BIT_SET((var), (pos)) : BIT_CLEAR((var), (pos))) |
| Set the value ([0,1], [true, false]) of bit pos (0-7) in byte var. | |
Functions | |
| static constexpr uint8_t | setBits (uint8_t n) |
| Set the first n bits of a byte. | |
Bit twiddling macros.
Toggle the value of bit pos (0-7) in byte var.
| #define BIT_WRITE | ( | var, | |
| pos, | |||
| bitvalue | |||
| ) | ((bitvalue) ? BIT_SET((var), (pos)) : BIT_CLEAR((var), (pos))) |
Set the value ([0,1], [true, false]) of bit pos (0-7) in byte var.