SatCat5
satcat5::cfg::I2cGeneric Class Referenceabstract

Detailed Description

Polymorphic API for a generic I2C interface.

See also
cfg::I2cAddr, cfg::I2cEventListener. This a generic interface for issuing I2C commands, to be implemented by any I2C controller. See also: cfgbus_i2c.h.

Definition at line 95 of file cfg_i2c.h.

#include <cfg_i2c.h>

Inheritance diagram for satcat5::cfg::I2cGeneric:
[legend]

Public Member Functions

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. More...
 
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. More...
 

Member Function Documentation

◆ read()

virtual bool satcat5::cfg::I2cGeneric::read ( const satcat5::util::I2cAddr devaddr,
u8  regbytes,
u32  regaddr,
u8  nread,
satcat5::cfg::I2cEventListener callback = 0 
)
pure virtual

Add a read operation to the queue.

  • If regbytes = 0: Start - Addr(R) - Read - Read - Stop
  • If regbytes > 0: Start - Addr(W) - Addr - Addr Start - Addr(R) - Data - Data - Stop Returns true if the command was added to the queue. Returns false if the user should try again later. (Child class MUST implement this method.

Implemented in satcat5::cfg::I2c, and satcat5::device::i2c::Tca9548.

◆ write()

virtual bool satcat5::cfg::I2cGeneric::write ( const satcat5::util::I2cAddr devaddr,
u8  regbytes,
u32  regaddr,
u8  nwrite,
const u8 *  data,
satcat5::cfg::I2cEventListener callback = 0 
)
pure virtual

Add a write operation to the queue.

  • If regbytes = 0: Start - Addr(W) - Data - Data - Stop
  • If regbytes > 0: Start - Addr(W) - Addr - Addr - Data - Data - Stop Returns true if the command was added to the queue. Returns false if the user should try again later. (Child class MUST implement this method.

Implemented in satcat5::cfg::I2c, and satcat5::device::i2c::Tca9548.


The documentation for this class was generated from the following file: