Firmware SDK
twr_tca9534a

Driver for TCA9534A I/O expander. More...

Data Structures

struct  twr_tca9534a_t
 Pin state. More...
 

Enumerations

enum  twr_tca9534a_pin_t {
  TWR_TCA9534A_PIN_P0 = 0 ,
  TWR_TCA9534A_PIN_P1 = 1 ,
  TWR_TCA9534A_PIN_P2 = 2 ,
  TWR_TCA9534A_PIN_P3 = 3 ,
  TWR_TCA9534A_PIN_P4 = 4 ,
  TWR_TCA9534A_PIN_P5 = 5 ,
  TWR_TCA9534A_PIN_P6 = 6 ,
  TWR_TCA9534A_PIN_P7 = 7
}
 Individual pin names.
 
enum  twr_tca9534a_pin_direction_t {
  TWR_TCA9534A_PIN_DIRECTION_OUTPUT = 0 ,
  TWR_TCA9534A_PIN_DIRECTION_INPUT = 1
}
 Pin direction.
 

Functions

bool twr_tca9534a_init (twr_tca9534a_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
 Initialize TCA9534A. More...
 
bool twr_tca9534a_read_port (twr_tca9534a_t *self, uint8_t *state)
 Read state of all pins. More...
 
bool twr_tca9534a_write_port (twr_tca9534a_t *self, uint8_t state)
 Write state to all pins. More...
 
bool twr_tca9534a_read_pin (twr_tca9534a_t *self, twr_tca9534a_pin_t pin, int *state)
 Read pin state. More...
 
bool twr_tca9534a_write_pin (twr_tca9534a_t *self, twr_tca9534a_pin_t pin, int state)
 Write pin state. More...
 
bool twr_tca9534a_get_port_direction (twr_tca9534a_t *self, uint8_t *direction)
 Get direction of all pins. More...
 
bool twr_tca9534a_set_port_direction (twr_tca9534a_t *self, uint8_t direction)
 Set direction of all pins. More...
 
bool twr_tca9534a_get_pin_direction (twr_tca9534a_t *self, twr_tca9534a_pin_t pin, twr_tca9534a_pin_direction_t *direction)
 Get pin direction. More...
 
bool twr_tca9534a_set_pin_direction (twr_tca9534a_t *self, twr_tca9534a_pin_t pin, twr_tca9534a_pin_direction_t direction)
 Set pin direction. More...
 

Detailed Description

Driver for TCA9534A I/O expander.

Function Documentation

◆ twr_tca9534a_get_pin_direction()

bool twr_tca9534a_get_pin_direction ( twr_tca9534a_t self,
twr_tca9534a_pin_t  pin,
twr_tca9534a_pin_direction_t direction 
)

Get pin direction.

Parameters
[in]selfInstance
[in]pinPin name
[out]directionPointer to variable where direction of pin will be stored
Returns
true On success
false On failure

Definition at line 99 of file twr_tca9534a.c.

◆ twr_tca9534a_get_port_direction()

bool twr_tca9534a_get_port_direction ( twr_tca9534a_t self,
uint8_t *  direction 
)

Get direction of all pins.

Parameters
[in]selfInstance
[out]directionPointer to variable where direction of all pins will be stored
Returns
true On success
false On failure

Definition at line 80 of file twr_tca9534a.c.

◆ twr_tca9534a_init()

bool twr_tca9534a_init ( twr_tca9534a_t self,
twr_i2c_channel_t  i2c_channel,
uint8_t  i2c_address 
)

Initialize TCA9534A.

Parameters
[in]selfInstance
[in]i2c_channelI2C channel
[in]i2c_addressI2C device address

Definition at line 8 of file twr_tca9534a.c.

Referenced by twr_module_gps_init(), twr_module_sensor_init(), and twr_module_x1_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_tca9534a_read_pin()

bool twr_tca9534a_read_pin ( twr_tca9534a_t self,
twr_tca9534a_pin_t  pin,
int *  state 
)

Read pin state.

Parameters
[in]selfInstance
[in]pinPin name
[out]statePointer to variable where state of pin will be stored
Returns
true On success
false On failure

Definition at line 47 of file twr_tca9534a.c.

Here is the call graph for this function:

◆ twr_tca9534a_read_port()

bool twr_tca9534a_read_port ( twr_tca9534a_t self,
uint8_t *  state 
)

Read state of all pins.

Parameters
[in]selfInstance
[out]statePointer to variable where state of all pins will be stored
Returns
true On success
false On failure

Definition at line 30 of file twr_tca9534a.c.

Referenced by twr_tca9534a_read_pin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_tca9534a_set_pin_direction()

bool twr_tca9534a_set_pin_direction ( twr_tca9534a_t self,
twr_tca9534a_pin_t  pin,
twr_tca9534a_pin_direction_t  direction 
)

Set pin direction.

Parameters
[in]selfInstance
[in]pinPin name
[in]directionDesired pin direction
Returns
true On success
false On failure

Definition at line 113 of file twr_tca9534a.c.

Referenced by twr_module_sensor_get_revision().

Here is the caller graph for this function:

◆ twr_tca9534a_set_port_direction()

bool twr_tca9534a_set_port_direction ( twr_tca9534a_t self,
uint8_t  direction 
)

Set direction of all pins.

Parameters
[in]selfInstance
[in]directionDesired direction of all pins
Returns
true On success
false On failure

Definition at line 87 of file twr_tca9534a.c.

Referenced by twr_module_gps_init(), twr_module_sensor_init(), and twr_module_x1_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_tca9534a_write_pin()

bool twr_tca9534a_write_pin ( twr_tca9534a_t self,
twr_tca9534a_pin_t  pin,
int  state 
)

Write pin state.

Parameters
[in]selfInstance
[in]pinPin name
[in]stateDesired state of pin
Returns
true On success
false On failure

Definition at line 61 of file twr_tca9534a.c.

Referenced by twr_module_gps_init(), twr_module_lcd_off(), and twr_module_lcd_on().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_tca9534a_write_port()

bool twr_tca9534a_write_port ( twr_tca9534a_t self,
uint8_t  state 
)

Write state to all pins.

Parameters
[in]selfInstance
[in]stateDesired state of all pins
Returns
true On success
false On failure

Definition at line 35 of file twr_tca9534a.c.

Referenced by twr_module_gps_init(), twr_module_sensor_init(), twr_module_sensor_set_pull(), twr_module_sensor_set_vdd(), twr_module_x1_init(), and twr_tca9534a_write_pin().

Here is the call graph for this function:
Here is the caller graph for this function: