1 #ifndef REGS_REGISTER_H 2 #define REGS_REGISTER_H 13 m_value = value.m_value;
15 void set(
T value)
volatile {
34 return ((((
T)1)<<(high-low+1))-1)<<low;
52 #define REGS_FIELD_R(name,type,high,low) type get##name() volatile { return (type)getBitRange(high,low); }; 53 #define REGS_FIELD_W(name,type,high,low) void set##name(type v) volatile { setBitRange(high, low, (uint8_t)v); }; 54 #define REGS_FIELD(name,type,high,low) REGS_FIELD_R(name,type,high,low); REGS_FIELD_W(name,type,high,low); 55 #define REGS_TYPE_FIELD(name,high,low) REGS_FIELD(name,name,high,low) 56 #define REGS_BOOL_FIELD(name,bit) REGS_FIELD(name,bool,bit,bit) 57 #define REGS_BOOL_FIELD_R(name,bit) REGS_FIELD_R(name,bool,bit,bit) 58 #define REGS_BOOL_FIELD_W(name,bit) REGS_FIELD_W(name,bool,bit,bit) 59 #define REGS_REGISTER_AT(name, offset) constexpr volatile name * name() const { return (class name *)(Base() + offset); };
static constexpr T bit_range_value(T value, uint8_t high, uint8_t low)
Register< uint16_t > Register16
Register< uint32_t > Register32
static constexpr T bit_range_mask(uint8_t high, uint8_t low)
void setBitRange(uint8_t high, uint8_t low, T value) volatile
Register< uint8_t > Register8
static constexpr T bit_range_set_value(uint8_t high, uint8_t low, T originalValue, T targetValue)
T getBitRange(uint8_t high, uint8_t low) volatile
Register< uint64_t > Register64