|
XPoint 0.1.0
Hardware-agnostic crosspoint matrix routing library
|
I2C channel-select decorator for the TCA9548A / PCA9548A. More...
#include <TCA9548AInterface.h>
Public Member Functions | |
| TCA9548AInterface (I2CInterface *bus, uint8_t muxAddr, uint8_t channel) | |
| void | begin () override |
| Initialise the underlying bus and invalidate this mux's channel cache. | |
| void | writeRegister (uint8_t devAddr, uint8_t reg, uint8_t val) override |
| Activate this channel (if not already selected), then forward the write. | |
Public Member Functions inherited from I2CInterface | |
| virtual | ~I2CInterface () |
| virtual void | writeByte (uint8_t addr, uint8_t data) |
| Write a single data byte to a device (no register address byte). | |
I2C channel-select decorator for the TCA9548A / PCA9548A.
writeRegister() selects this instance's channel on the mux (if not already selected) then forwards the write to the underlying bus. The matrix and driver layers are completely unaware of the multiplexer.
Channel state is cached per mux address in a function-local static array (8 bytes of BSS). Calling begin() invalidates the cache entry for this mux so the first subsequent write always emits the channel-select byte.
|
inline |
| [in] | bus | Physical I2C bus; must outlive this object. |
| [in] | muxAddr | TCA9548A 7-bit address (0x70–0x77). |
| [in] | channel | Bus segment to activate on writeRegister() (0–7). |
|
inlineoverridevirtual |
Initialise the underlying bus and invalidate this mux's channel cache.
Call once per mux address in setup() before any matrix.begin() calls. Invalidating the cache guarantees the channel-select byte is sent on the very first writeRegister() even if that channel was previously active.
Reimplemented from I2CInterface.
|
inlineoverridevirtual |
Activate this channel (if not already selected), then forward the write.
When the channel is already active the mux write is suppressed entirely — zero overhead compared to a direct I2C connection.
| [in] | devAddr | 7-bit address of the target device (e.g. MCP23017). |
| [in] | reg | Register index on the target device. |
| [in] | val | Byte value to write. |
Implements I2CInterface.