XPoint 0.1.0
Hardware-agnostic crosspoint matrix routing library
Loading...
Searching...
No Matches
TCA9548AInterface.h File Reference

Transparent I2C bus-multiplexer adapter for the TCA9548A / PCA9548A. More...

#include "I2CInterface.h"

Go to the source code of this file.

Classes

class  TCA9548AInterface
 I2C channel-select decorator for the TCA9548A / PCA9548A. More...
 

Detailed Description

Transparent I2C bus-multiplexer adapter for the TCA9548A / PCA9548A.

Drop this decorator between any I2CInterface consumer (e.g. MCP23017Driver) and the physical bus (e.g. WireI2C) to transparently route I2C traffic through a specific channel of a TCA9548A / PCA9548A bus multiplexer.

Capacity: one TCA9548A provides 8 independent I2C segments; up to 8 TCA9548As share one bus (addresses 0x70–0x77), giving 64 segments total. Each segment supports up to 8 MCP23017s (address pins A0–A2), so the maximum reachable I/O is 64 × 8 × 16 = 8192 pins from a single bus.

Performance: a per-mux channel cache (8 bytes of BSS) ensures the channel-select byte is only sent when the active channel actually changes. After warm-up, a relay operation on an already-selected channel incurs zero extra I2C transactions — identical overhead to having no mux at all.

Usage:

WireI2C wire;
// Two MCP23017s on channel 0 of TCA9548A at 0x70:
TCA9548AInterface ch0(&wire, 0x70, 0);
MCP23017Driver gpioA(&ch0, 0x20, mapperA);
MCP23017Driver gpioB(&ch0, 0x21, mapperB);
// One MCP23017 on channel 1 (same mux, different segment):
TCA9548AInterface ch1(&wire, 0x70, 1);
MCP23017Driver gpioC(&ch1, 0x20, mapperC);
// setup():
ch0.begin(); // initialises Wire and primes the channel cache
matrixA.begin();
matrixB.begin();
matrixC.begin();
XPointDriver implementation for the MCP23017 16-bit I2C GPIO expander.
Definition MCP23017Driver.h:40
I2C channel-select decorator for the TCA9548A / PCA9548A.
Definition TCA9548AInterface.h:63
I2CInterface implementation that delegates to the Arduino Wire library.
Definition WireI2C.h:37
Note
TCA9548AInterface is header-only; no extra compilation unit required.