Class daisy::Tca9534¶
#include <tca9534.h>
Classes¶
| Type | Name |
|---|---|
| struct | Config |
Public Functions¶
| Type | Name |
|---|---|
| uint8_t | Address () const |
| uint8_t | ConfigRegister () const |
| void | Init () |
| void | Init (const Config & config) |
| void | Init (I2CHandle & i2c, uint8_t address=0x20) |
| bool | LastReadOk () const |
| bool | LastTransferOk () const |
| uint8_t | OutputState () const |
| bool | PinMode (uint8_t pin, Tca9534Mode mode) |
| bool | ReadInput (uint8_t & value) |
| bool | ReadPin (uint8_t pin, bool & high) |
| bool | SetConfig (uint8_t config) |
| bool | SetOutputState (uint8_t output) |
| Tca9534 () |
|
| bool | WritePin (uint8_t pin, bool high) |
Detailed Description¶
Driver for the Texas Instruments TCA9534 (and TCA9534A) 8-bit I2C GPIO expander.
Address range is typically 0x20–0x27 depending on A0/A1/A2 (TCA9534A uses 0x38–0x3F).
Two init styles are supported:
* Owned bus: Init(Config) creates/initializes an I2C peripheral (like Mcp23017).
* Shared bus: Init( I2CHandle &, address) reuses an already-configured I2CHandle (useful when LEDs / codecs already own the same bus).
Usage (shared bus):
I2CHandle i2c;
i2c.Init(...);
Tca9534 exp;
exp.Init(i2c, 0x21);
exp.SetConfig(0xFE); // P0 output, P1–P7 inputs
exp.WritePin(0, true);
uint8_t port = 0;
exp.ReadInput(port);
Public Functions Documentation¶
function Address¶
function ConfigRegister¶
function Init [⅓]¶
Initialize with default Seed I2C1 pins and address 0x20.
function Init [⅔]¶
Initialize and own a dedicated I2C peripheral.
function Init [3/3]¶
Attach to an already-initialized I2CHandle (shared bus). Does not re-init the peripheral.
function LastReadOk¶
Alias matching early Cosmolab naming.
function LastTransferOk¶
function OutputState¶
function PinMode¶
function ReadInput¶
function ReadPin¶
function SetConfig¶
1 = input, 0 = output for each bit.
function SetOutputState¶
function Tca9534¶
function WritePin¶
The documentation for this class was generated from the following file external-docs/libDaisy/src/dev/tca9534.h