arduino-audio-driver
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TCA9555 Class Reference

Driver for the TCA9555 I2C I/O expander (header-only). More...

#include <TCA9555.h>

Inheritance diagram for TCA9555:
API_GPIO

Public Member Functions

 TCA9555 ()
 Construct a new TCA9555 object with default I2C address 0x20.
 
bool begin (IDriverPins &pins) override
 Initialize the TCA9555 and create the I2C bus.
 
bool digitalRead (int pin) override
 Read the input state of a pin.
 
bool digitalWrite (int pin, bool value) override
 Set the output state of a pin.
 
void end () override
 Deinitialize the TCA9555 and delete the I2C bus.
 
void pinMode (int pin, int mode) override
 Set the direction of a pin.
 
void setI2CAddress (uint8_t address)
 Set the I2C address for the TCA9555.
 

Protected Member Functions

bool i2c_read (uint8_t addr, uint8_t reg, uint8_t *data, size_t len)
 Helper to read bytes from the TCA9555 using the platform I2C abstraction.
 
bool i2c_write (uint8_t addr, uint8_t reg, uint8_t *data, size_t len)
 Helper to write bytes to the TCA9555 using the platform I2C abstraction.
 

Protected Attributes

i2c_bus_handle_t bus = nullptr
 
uint8_t i2c_default_address
 

Detailed Description

Driver for the TCA9555 I2C I/O expander (header-only).

Provides methods to configure pin direction, read and write pin states, and manage the I2C bus.

Constructor & Destructor Documentation

◆ TCA9555()

TCA9555 ( )
inline

Construct a new TCA9555 object with default I2C address 0x20.

Member Function Documentation

◆ begin()

bool begin ( IDriverPins pins)
inlineoverridevirtual

Initialize the TCA9555 and create the I2C bus.

Parameters
pinsDriverPins structure with SCL and SDA pin assignments.
Returns
true if initialization was successful, false otherwise.

Implements API_GPIO.

◆ digitalRead()

bool digitalRead ( int  pin)
inlineoverridevirtual

Read the input state of a pin.

Parameters
pinPin number (0-15).
Returns
true if HIGH, false if LOW or on error.

Implements API_GPIO.

◆ digitalWrite()

bool digitalWrite ( int  pin,
bool  value 
)
inlineoverridevirtual

Set the output state of a pin.

Parameters
pinPin number (0-15).
valuetrue for HIGH, false for LOW.
Returns
true if successful, false otherwise.

Implements API_GPIO.

◆ end()

void end ( )
inlineoverridevirtual

Deinitialize the TCA9555 and delete the I2C bus.

Returns
true always.

Implements API_GPIO.

◆ i2c_read()

bool i2c_read ( uint8_t  addr,
uint8_t  reg,
uint8_t *  data,
size_t  len 
)
inlineprotected

Helper to read bytes from the TCA9555 using the platform I2C abstraction.

◆ i2c_write()

bool i2c_write ( uint8_t  addr,
uint8_t  reg,
uint8_t *  data,
size_t  len 
)
inlineprotected

Helper to write bytes to the TCA9555 using the platform I2C abstraction.

◆ pinMode()

void pinMode ( int  pin,
int  mode 
)
inlineoverridevirtual

Set the direction of a pin.

Parameters
pinPin number (0-15).
inputtrue for input, false for output.
Returns
true if successful, false otherwise.

Implements API_GPIO.

◆ setI2CAddress()

void setI2CAddress ( uint8_t  address)
inline

Set the I2C address for the TCA9555.

Parameters
addressThe new I2C address.

Member Data Documentation

◆ bus

i2c_bus_handle_t bus = nullptr
protected

◆ i2c_default_address

uint8_t i2c_default_address
protected

The documentation for this class was generated from the following file: