46#ifndef TCA9548A_INTERFACE_H
47#define TCA9548A_INTERFACE_H
74 static uint8_t &_lastSel(uint8_t slot)
76 static uint8_t s[8] = {0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu};
82 inline void _selectIfNeeded()
84 uint8_t &sel = _lastSel(_muxAddr & 0x7u);
85 if (sel != _channelMask)
99 : _bus(bus), _muxAddr(muxAddr), _channelMask((uint8_t)(1u << (channel & 0x7u)))
113 _lastSel(_muxAddr & 0x7u) = 0xFFu;
Minimal abstract I2C interface consumed by MCP23017Driver.
Abstract I2C bus interface.
Definition I2CInterface.h:28
virtual void begin()
Initialize the I2C bus.
Definition I2CInterface.h:40
virtual void writeRegister(uint8_t addr, uint8_t reg, uint8_t val)=0
Write one byte to a device register.
virtual void writeByte(uint8_t addr, uint8_t data)
Write a single data byte to a device (no register address byte).
Definition I2CInterface.h:67
I2C channel-select decorator for the TCA9548A / PCA9548A.
Definition TCA9548AInterface.h:63
void writeRegister(uint8_t devAddr, uint8_t reg, uint8_t val) override
Activate this channel (if not already selected), then forward the write.
Definition TCA9548AInterface.h:126
void begin() override
Initialise the underlying bus and invalidate this mux's channel cache.
Definition TCA9548AInterface.h:110
TCA9548AInterface(I2CInterface *bus, uint8_t muxAddr, uint8_t channel)
Definition TCA9548AInterface.h:98