AM64x MCU+ SDK  08.02.00
APIs for TCA6424 IO Expander driver

Introduction

This module contains APIs to program and use I2C based TCA6424 IO Expander module on the board.

Data Structures

struct  TCA6424_Params
 Parameters passed during TCA6424_open() More...
 
struct  TCA6424_Attrs
 IO Expander device attributes. More...
 
struct  TCA6424_Config
 IO Expander driver configuration. This is the driver object used to store state variables. More...
 

Functions

int32_t TCA6424_open (TCA6424_Config *config, const TCA6424_Params *params)
 Open TCA6424 driver. More...
 
void TCA6424_close (TCA6424_Config *config)
 Close TCA6424 driver. More...
 
int32_t TCA6424_config (TCA6424_Config *config, uint32_t ioIndex, uint32_t mode)
 API to set a IO pin of TCA6424 as input or output. More...
 
int32_t TCA6424_setOutput (TCA6424_Config *config, uint32_t ioIndex, uint32_t state)
 API to set a IO pin of TCA6424 to either HIGH or LOW. More...
 
void TCA6424_getAttrs (TCA6424_Config *config, TCA6424_Attrs *attrs)
 Returns TCA6424 attributes. More...
 
void TCA6424_Params_init (TCA6424_Params *params)
 Set default parameters in the TCA6424_Params structure. More...
 

IO pin mode - Input or Output

#define TCA6424_MODE_INPUT   (0U)
 Configure IO pin as input. More...
 
#define TCA6424_MODE_OUTPUT   (1U)
 Configure IO pin as output. More...
 

IO pin output state - HIGH or LOW

#define TCA6424_OUT_STATE_LOW   (0U)
 Configure IO pin output as LOW. More...
 
#define TCA6424_OUT_STATE_HIGH   (1U)
 Configure IO pin output as HIGH. More...
 

Macro Definition Documentation

◆ TCA6424_MODE_INPUT

#define TCA6424_MODE_INPUT   (0U)

Configure IO pin as input.

◆ TCA6424_MODE_OUTPUT

#define TCA6424_MODE_OUTPUT   (1U)

Configure IO pin as output.

◆ TCA6424_OUT_STATE_LOW

#define TCA6424_OUT_STATE_LOW   (0U)

Configure IO pin output as LOW.

◆ TCA6424_OUT_STATE_HIGH

#define TCA6424_OUT_STATE_HIGH   (1U)

Configure IO pin output as HIGH.

Function Documentation

◆ TCA6424_open()

int32_t TCA6424_open ( TCA6424_Config config,
const TCA6424_Params params 
)

Open TCA6424 driver.

Make sure the I2C driver is opened before calling this API.

Parameters
config[IN] Driver object. Caller need to allocate memory for this.
params[IN] Open parameters
Returns
SystemP_SUCCESS on success, else failure

◆ TCA6424_close()

void TCA6424_close ( TCA6424_Config config)

Close TCA6424 driver.

Parameters
config[IN] TCA6424 driver config from TCA6424_open

◆ TCA6424_config()

int32_t TCA6424_config ( TCA6424_Config config,
uint32_t  ioIndex,
uint32_t  mode 
)

API to set a IO pin of TCA6424 as input or output.

Parameters
config[IN] TCA6424 driver config from TCA6424_open
ioIndex[IN] Index to the TCA6424 IO which needs to be set/reset.
mode[IN] Refer TCA6424_Mode
Returns
SystemP_SUCCESS on success, else failure

◆ TCA6424_setOutput()

int32_t TCA6424_setOutput ( TCA6424_Config config,
uint32_t  ioIndex,
uint32_t  state 
)

API to set a IO pin of TCA6424 to either HIGH or LOW.

Parameters
config[IN] TCA6424 driver config from TCA6424_open
ioIndex[IN] Index to the TCA6424 IO which needs to be set/reset.
state[IN] Refer TCA6424_OutState
Returns
SystemP_SUCCESS on success, else failure

◆ TCA6424_getAttrs()

void TCA6424_getAttrs ( TCA6424_Config config,
TCA6424_Attrs attrs 
)

Returns TCA6424 attributes.

Parameters
config[IN] TCA6424 driver config from TCA6424_open
attrs[IN/OUT] Structure where the attribute is returned

◆ TCA6424_Params_init()

void TCA6424_Params_init ( TCA6424_Params params)

Set default parameters in the TCA6424_Params structure.

Call this API to set defaults and then override the fields as needed before calling TCA6424_open.

Parameters
params[OUT] Initialized parameters