I2Cdevlib

I2C device library collection for AVR/Arduino or other C++-based MCUs

Public Member Functions
TCA6424A Class Reference

Public Member Functions

 TCA6424A ()
 TCA6424A (uint8_t address)
void initialize ()
bool testConnection ()
bool readPin (uint16_t pin)
uint8_t readBank (uint8_t bank)
void readAll (uint8_t *banks)
void readAll (uint8_t *bank0, uint8_t *bank1, uint8_t *bank2)
bool getPinOutputLevel (uint16_t pin)
uint8_t getBankOutputLevel (uint8_t bank)
void getAllOutputLevel (uint8_t *banks)
void getAllOutputLevel (uint8_t *bank0, uint8_t *bank1, uint8_t *bank2)
void writePin (uint16_t pin, bool polarity)
void writeBank (uint8_t bank, uint8_t value)
void writeAll (uint8_t *banks)
void writeAll (uint8_t bank0, uint8_t bank1, uint8_t bank2)
bool getPinPolarity (uint16_t pin)
uint8_t getBankPolarity (uint8_t bank)
void getAllPolarity (uint8_t *banks)
void getAllPolarity (uint8_t *bank0, uint8_t *bank1, uint8_t *bank2)
void setPinPolarity (uint16_t pin, bool polarity)
void setBankPolarity (uint8_t bank, uint8_t polarity)
void setAllPolarity (uint8_t *banks)
void setAllPolarity (uint8_t bank0, uint8_t bank1, uint8_t bank2)
bool getPinDirection (uint16_t pin)
uint8_t getBankDirection (uint8_t bank)
void getAllDirection (uint8_t *banks)
void getAllDirection (uint8_t *bank0, uint8_t *bank1, uint8_t *bank2)
void setPinDirection (uint16_t pin, bool direction)
void setBankDirection (uint8_t bank, uint8_t direction)
void setAllDirection (uint8_t *banks)
void setAllDirection (uint8_t bank0, uint8_t bank1, uint8_t bank2)

Constructor & Destructor Documentation

TCA6424A::TCA6424A ( )

Default constructor, uses default I2C address.

See also:
TCA6424A_DEFAULT_ADDRESS
TCA6424A::TCA6424A ( uint8_t  address)

Specific address constructor.

Parameters:
addressI2C address
See also:
TCA6424A_DEFAULT_ADDRESS
TCA6424A_ADDRESS_ADDR_LOW
TCA6424A_ADDRESS_ADDR_HIGH

Member Function Documentation

void TCA6424A::getAllDirection ( uint8_t *  banks)

Get all pin direction (I/O) settings from all banks. Reads into single 3-byte data container.

Parameters:
banksContainer for all bank's pin values (P00-P27)
void TCA6424A::getAllDirection ( uint8_t *  bank0,
uint8_t *  bank1,
uint8_t *  bank2 
)

Get all pin direction (I/O) settings from all banks. Reads into individual 1-byte containers.

Parameters:
bank0Container for Bank 0's pin values (P00-P07)
bank1Container for Bank 1's pin values (P10-P17)
bank2Container for Bank 2's pin values (P20-P27)
void TCA6424A::getAllOutputLevel ( uint8_t *  bank0,
uint8_t *  bank1,
uint8_t *  bank2 
)

Get all pin output settings from all banks. Reads into individual 1-byte containers. Note that this returns the level set in the flip-flop, and does not necessarily represent the actual logic level present at the pin.

Parameters:
bank0Container for Bank 0's pin values (P00-P07)
bank1Container for Bank 1's pin values (P10-P17)
bank2Container for Bank 2's pin values (P20-P27)
void TCA6424A::getAllOutputLevel ( uint8_t *  banks)

Get all pin output settings from all banks. Reads into single 3-byte data container.

Parameters:
banksContainer for all bank's pin values (P00-P27)
void TCA6424A::getAllPolarity ( uint8_t *  banks)

Get all pin polarity (normal/inverted) settings from all banks. Reads into single 3-byte data container.

Parameters:
banksContainer for all bank's pin values (P00-P27)
void TCA6424A::getAllPolarity ( uint8_t *  bank0,
uint8_t *  bank1,
uint8_t *  bank2 
)

Get all pin polarity (normal/inverted) settings from all banks. Reads into individual 1-byte containers.

Parameters:
bank0Container for Bank 0's pin values (P00-P07)
bank1Container for Bank 1's pin values (P10-P17)
bank2Container for Bank 2's pin values (P20-P27)
uint8_t TCA6424A::getBankDirection ( uint8_t  bank)

Get all pin direction (I/O) settings from one bank.

Parameters:
bankWhich bank to read (0/1/2 for P0*, P1*, P2* respectively)
Returns:
8 pins' direction settings (0 or 1 for each pin)
uint8_t TCA6424A::getBankOutputLevel ( uint8_t  bank)

Get all pin output settings from one bank. Note that this returns the level set in the flip-flop, and does not necessarily represent the actual logic level present at the pin.

Parameters:
bankWhich bank to read (0/1/2 for P0*, P1*, P2* respectively)
Returns:
8 pins' output settings (0 or 1 for each pin)
uint8_t TCA6424A::getBankPolarity ( uint8_t  bank)

Get all pin polarity (normal/inverted) settings from one bank.

Parameters:
bankWhich bank to read (0/1/2 for P0*, P1*, P2* respectively)
Returns:
8 pins' polarity settings (0 or 1 for each pin)
bool TCA6424A::getPinDirection ( uint16_t  pin)

Get a single pin's direction (I/O) setting.

Returns:
Pin direction setting (0 or 1)
bool TCA6424A::getPinOutputLevel ( uint16_t  pin)

Get a single OUTPUT pin's setting. Note that this returns the level set in the flip-flop, and does not necessarily represent the actual logic level present at the pin.

Returns:
Pin output setting (0 or 1)
bool TCA6424A::getPinPolarity ( uint16_t  pin)

Get a single pin's polarity (normal/inverted) setting.

Returns:
Pin polarity setting (0 or 1)
void TCA6424A::initialize ( )

Power on and prepare for general usage. The TCA6424A I/O expander requires no preparation after power-on. All pins will be default to INPUT mode, and the device is ready for usage immediately. This is an empty function for consistency and/or future expansion.

void TCA6424A::readAll ( uint8_t *  banks)

Get all pin logic levels from all banks. Reads into single 3-byte data container.

Parameters:
banksContainer for all bank's pin values (P00-P27)
void TCA6424A::readAll ( uint8_t *  bank0,
uint8_t *  bank1,
uint8_t *  bank2 
)

Get all pin logic levels from all banks. Reads into individual 1-byte containers.

Parameters:
bank0Container for Bank 0's pin values (P00-P07)
bank1Container for Bank 1's pin values (P10-P17)
bank2Container for Bank 2's pin values (P20-P27)
uint8_t TCA6424A::readBank ( uint8_t  bank)

Get all pin logic levels from one bank.

Parameters:
bankWhich bank to read (0/1/2 for P0*, P1*, P2* respectively)
Returns:
8 pins' logic levels (0 or 1 for each pin)
bool TCA6424A::readPin ( uint16_t  pin)

Get a single INPUT pin's logic level.

Returns:
Pin logic level (0 or 1)
void TCA6424A::setAllDirection ( uint8_t  bank0,
uint8_t  bank1,
uint8_t  bank2 
)

Set all pin direction (I/O) settings in all banks.

Parameters:
bank0Bank 0's new direction values (P00-P07)
bank1Bank 1's new direction values (P10-P17)
bank2Bank 2's new direction values (P20-P27)
void TCA6424A::setAllDirection ( uint8_t *  banks)

Set all pin direction (I/O) settings in all banks.

Parameters:
banksAll pins' new direction values (P00-P27) in 3-byte array
void TCA6424A::setAllPolarity ( uint8_t *  banks)

Set all pin polarity (normal/inverted) settings in all banks.

Parameters:
banksAll pins' new logic values (P00-P27) in 3-byte array
void TCA6424A::setAllPolarity ( uint8_t  bank0,
uint8_t  bank1,
uint8_t  bank2 
)

Set all pin polarity (normal/inverted) settings in all banks.

Parameters:
bank0Bank 0's new polarity values (P00-P07)
bank1Bank 1's new polarity values (P10-P17)
bank2Bank 2's new polarity values (P20-P27)
void TCA6424A::setBankDirection ( uint8_t  bank,
uint8_t  direction 
)

Set all pin direction (I/O) settings in one bank.

Parameters:
bankWhich bank to read (0/1/2 for P0*, P1*, P2* respectively)
directionNew pins' direction settings (0 or 1 for each pin)
void TCA6424A::setBankPolarity ( uint8_t  bank,
uint8_t  polarity 
)

Set all pin polarity (normal/inverted) settings in one bank.

Parameters:
bankWhich bank to write (0/1/2 for P0*, P1*, P2* respectively)
Returns:
New pins' polarity settings (0 or 1 for each pin)
void TCA6424A::setPinDirection ( uint16_t  pin,
bool  direction 
)

Set a single pin's direction (I/O) setting.

Parameters:
pinWhich pin to write (0-23)
directionPin direction setting (0 or 1)
void TCA6424A::setPinPolarity ( uint16_t  pin,
bool  polarity 
)

Set a single pin's polarity (normal/inverted) setting.

Parameters:
pinWhich pin to write (0-23)
polarityNew pin polarity setting (0 or 1)
bool TCA6424A::testConnection ( )

Verify the I2C connection. Make sure the device is connected and responds as expected.

Returns:
True if connection is valid, false otherwise
void TCA6424A::writeAll ( uint8_t *  banks)

Set all OUTPUT pins' logic levels in all banks.

Parameters:
banksAll pins' new logic values (P00-P27) in 3-byte array
void TCA6424A::writeAll ( uint8_t  bank0,
uint8_t  bank1,
uint8_t  bank2 
)

Set all OUTPUT pins' logic levels in all banks.

Parameters:
bank0Bank 0's new logic values (P00-P07)
bank1Bank 1's new logic values (P10-P17)
bank2Bank 2's new logic values (P20-P27)
void TCA6424A::writeBank ( uint8_t  bank,
uint8_t  value 
)

Set all OUTPUT pins' logic levels in one bank.

Parameters:
bankWhich bank to write (0/1/2 for P0*, P1*, P2* respectively)
valueNew pins' output logic level (0 or 1 for each pin)
void TCA6424A::writePin ( uint16_t  pin,
bool  value 
)

Set a single OUTPUT pin's logic level.

Parameters:
pinWhich pin to write (0-23)
valueNew pin output logic level (0 or 1)

The documentation for this class was generated from the following files:
 All Data Structures Functions Variables