49 {
return I2cAddr(0xF000 | ((addr&0x300)<<1) | (addr&0xFF));}
80 virtual void i2c_done(
110 u8 regbytes, u32 regaddr, u8 nread,
122 u8 regbytes, u32 regaddr, u8 nwrite,
const u8* data,
Callback interface for cfg::I2cGeneric events.
Polymorphic API for a generic I2C interface.
virtual bool busy()=0
Is the I2C controller currently busy?
virtual bool read(const satcat5::util::I2cAddr &devaddr, u8 regbytes, u32 regaddr, u8 nread, satcat5::cfg::I2cEventListener *callback=0)=0
Add a read operation to the queue.
virtual bool write(const satcat5::util::I2cAddr &devaddr, u8 regbytes, u32 regaddr, u8 nwrite, const u8 *data, satcat5::cfg::I2cEventListener *callback=0)=0
Add a write operation to the queue.
Conversion function for I2C device addresses.
const u16 m_addr
Native internal address representation.
static constexpr I2cAddr addr8(u8 addr)
Create I2C address from an 8-bit input (left-justified) Example: I2cAddr my_addr = I2cAddr::addr8(0xE...
bool operator!=(const I2cAddr &other) const
Comparison operators:
static constexpr I2cAddr addr7(u8 addr)
Create I2C address from a 7-bit input (right-justified) Example: I2cAddr my_addr = I2cAddr::addr7(0x7...
bool operator==(const I2cAddr &other) const
Comparison operators:
bool is_10b() const
Is this a 10-bit address?
static constexpr I2cAddr addr10(u16 addr)
Create I2C address from a 10-bit input (right-justified) Example: I2cAddr my_addr = I2cAddr::addr10(0...
static constexpr I2cAddr native(u16 addr)
Create I2C address from its native internal representation.
Basic type aliases and prototypes used throughout SatCat5.