Bit and byte data type definitions.
More...
|
#define | LSBFIRST 0 |
| Least Significant Bit first.
|
|
#define | MSBFIRST 1 |
| Most Significant Bit first.
|
|
#define | bit(b) (1UL << (b)) |
| Computes the value of the specified bit (bit 0 is 1, bit 1 is 2, bit 2 is 4, etc.). More...
|
|
#define | bitRead(value, bit) (((value) >> (bit)) & 0x01) |
| Reads the value of a specific bit. More...
|
|
#define | bitSet(value, bit) ((value) |= (1UL << (bit))) |
| Sets a specific bit. More...
|
|
#define | bitClear(value, bit) ((value) &= ~(1UL << (bit))) |
| Clears a specific bit. More...
|
|
#define | bitToggle(value, bit) ((value) ^= (1UL << (bit))) |
| Toggles a specific bit. More...
|
|
#define | bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit)) |
| Writes a specific bit. More...
|
|
#define | lowByte(w) ((uint8_t) ((w) & 0xff)) |
| Extracts the low-order (rightmost) byte of a variable (e.g. a word). More...
|
|
#define | highByte(w) ((uint8_t) ((w) >> 8)) |
| Extracts the high-order (leftmost) byte of a word (or the second lowest byte of a larger data type). More...
|
|
|
typedef unsigned int | word |
| Represents a 16-bit unsigned integer.
|
|
typedef bool | boolean |
| Represents a boolean value (true or false).
|
|
typedef uint8_t | byte |
| Represents an 8-bit unsigned integer.
|
|
Bit and byte data type definitions.
◆ bit
#define bit |
( |
|
b | ) |
(1UL << (b)) |
◆ bitClear
#define bitClear |
( |
|
value, |
|
|
|
bit |
|
) |
| ((value) &= ~(1UL << (bit))) |
◆ bitRead
#define bitRead |
( |
|
value, |
|
|
|
bit |
|
) |
| (((value) >> (bit)) & 0x01) |
Reads the value of a specific bit.
- Parameters
-
value | The number from which to read. |
bit | Which bit to read, starting at 0 for the least-significant (rightmost) bit. |
- Returns
- The value of the specified bit (0 or 1).
Reads a bit of a variable, e.g. bool, int. Note that float & double are not supported. You can read the bit of variables up to an unsigned long long (64 bits / 8 bytes).
- See also
- https://www.arduino.cc/reference/en/language/functions/bits-and-bytes/bitread
◆ bitSet
#define bitSet |
( |
|
value, |
|
|
|
bit |
|
) |
| ((value) |= (1UL << (bit))) |
Sets a specific bit.
- Parameters
-
value | The number in which to set a bit. |
bit | Which bit to set, starting at 0 for the least-significant (rightmost) bit. |
- Returns
- The value of the numeric variable after the bit at position n is set.
Sets a bit of a variable, e.g. bool, int. Note that float & double are not supported. You can set the bit of variables up to an unsigned long long (64 bits / 8 bytes).
- See also
- https://www.arduino.cc/reference/en/language/functions/bits-and-bytes/bitset
◆ bitToggle
#define bitToggle |
( |
|
value, |
|
|
|
bit |
|
) |
| ((value) ^= (1UL << (bit))) |
◆ bitWrite
◆ highByte
#define highByte |
( |
|
w | ) |
((uint8_t) ((w) >> 8)) |
◆ lowByte
#define lowByte |
( |
|
w | ) |
((uint8_t) ((w) & 0xff)) |