|
SatCat5
|
Device driver for PCA9548A / TCA9548A I2C switches.
The NXP Semiconductors PCA9548A and the Texas Instruments TCA9548A are pin-compatible devices that connect one I2C master to one of eight I2C channels. This driver controls either device, allowing for channel selection and then presenting an I2C interface for downstream devices to use.
Reference: https://www.nxp.com/docs/en/data-sheet/PCA9548A.pdf Reference: https://www.ti.com/product/TCA9548A
Definition at line 28 of file i2c_tca9548.h.
#include <i2c_tca9548.h>
Public Member Functions | |
| Tca9548 (satcat5::cfg::I2cGeneric *i2c, const satcat5::util::I2cAddr &devaddr) | |
| Constructor links to the specified I2C bus. | |
| bool | select_mask (u8 mask) |
| Select a channel or channel(s). More... | |
| bool | select_channel (unsigned n) |
| Shortcut for selecting a specific channel. More... | |
| bool | busy () override |
| Is the I2C controller currently busy? | |
| bool | read (const satcat5::util::I2cAddr &devaddr, u8 regbytes, u32 regaddr, u8 nread, satcat5::cfg::I2cEventListener *callback=0) override |
| Add a read operation to the queue. More... | |
| bool | write (const satcat5::util::I2cAddr &devaddr, u8 regbytes, u32 regaddr, u8 nwrite, const u8 *data, satcat5::cfg::I2cEventListener *callback=0) override |
| Add a write operation to the queue. More... | |
Protected Member Functions | |
| void | i2c_done (bool noack, const satcat5::util::I2cAddr &devaddr, u32 regaddr, unsigned nread, const u8 *rdata) override |
| unsigned | cb_wridx () const |
Protected Attributes | |
| satcat5::cfg::I2cGeneric *const | m_parent |
| const satcat5::util::I2cAddr | m_devaddr |
| unsigned | m_cb_count |
| unsigned | m_cb_rdidx |
| satcat5::cfg::I2cEventListener * | m_cb_queue [SATCAT5_I2C_MAXCMD] |
|
overridevirtual |
Add a read operation to the queue.
Implements satcat5::cfg::I2cGeneric.
Definition at line 35 of file i2c_tca9548.cc.
|
inline |
Shortcut for selecting a specific channel.
Definition at line 45 of file i2c_tca9548.h.
| bool Tca9548::select_mask | ( | u8 | mask | ) |
Select a channel or channel(s).
Due to limited buffer space, the caller is responsible for retrying commands that cannot be queued immediately.
Definition at line 23 of file i2c_tca9548.cc.
|
overridevirtual |
Add a write operation to the queue.
Implements satcat5::cfg::I2cGeneric.
Definition at line 51 of file i2c_tca9548.cc.