Struct regbit_t

Struct Documentation

struct regbit_t

Representation of a register field or bit position.

Defined by the I/O register address, a bit position and a mask.

Public Functions

explicit regbit_t(reg_addr_t a, uint8_t b, uint8_t m)
explicit regbit_t(reg_addr_t a, uint8_t b)
explicit regbit_t(reg_addr_t a, const bitmask_t &bm)
explicit regbit_t(reg_addr_t a)
regbit_t()
regbit_t(const regbit_t &rb)
regbit_t &operator=(const regbit_t &rb)
inline bool valid() const

Returns the validity of the register address

inline uint8_t extract(uint8_t value) const

Extracts the field value from the register value

inline uint8_t set_to(uint8_t reg, uint8_t value = 0xFF) const

Performs a bitwise OR between the register value and the field value

inline uint8_t clear_from(uint8_t reg, uint8_t value = 0xFF) const

Performs a bitwise NEG-AND between the register value and the field value

inline uint8_t replace(uint8_t reg, uint8_t value) const

Replace the field value within the register value

int bitcount() const

Returns the number of bits in the field

Public Members

reg_addr_t addr
uint8_t bit
uint8_t mask