Macros | |
#define | BIT_(n) (1U << (n)) |
n-th Bit | |
#define | BIT_SET_(x, n) ( (x) | BIT_(n) ) |
set n-th bit of x to 1 | |
#define | BIT_CLR_(x, n) ( (x) & (~BIT_(n)) ) |
clear n-th bit of x | |
#define | BIT_TEST_(x, n) ( ((x) & BIT_(n)) ? true : false ) |
check if n-th bit of x is 1 | |
#define | _B8__(x) |
#define | BIN8(d) ((uint8_t) _B8__(0x##d##UL)) |
#define | BIN16(dmsb, dlsb) (((uint16_t)BIN8(dmsb)<<8) + BIN8(dlsb)) |
#define | BIN32(dmsb, db2, db3, dlsb) |
Functions | |
static uint32_t | bit_set (uint32_t value, uint8_t n) ATTR_CONST ATTR_ALWAYS_INLINE |
static uint32_t | bit_clear (uint32_t value, uint8_t n) ATTR_CONST ATTR_ALWAYS_INLINE |
static bool | bit_test (uint32_t value, uint8_t n) |
create a mask with n-bit lsb set to 1 | |
static uint32_t | bit_mask (uint8_t n) ATTR_CONST ATTR_ALWAYS_INLINE |
static uint32_t | bit_mask_range (uint8_t start, uint32_t end) ATTR_CONST ATTR_ALWAYS_INLINE |
static uint32_t | bit_set_range (uint32_t value, uint8_t start, uint8_t end, uint32_t pattern) ATTR_CONST ATTR_ALWAYS_INLINE |
#define _B8__ | ( | x | ) |