EVE 1.0
Collaboration diagram for PCAL9535a GPIO driver:

Data Structures

struct  gpio_ext_pcal_state_t
 
struct  gpio_ext_pcal_t
 

Variables

const struct gpio_ext_api_t GpioPcalFunc
 

Functions called from application programs

uint16_t ReadPcal (const struct gpio_ext_t *GpioExt, uint8_t Address)
 
void WritePcal (const struct gpio_ext_t *GpioExt, uint8_t Address, uint16_t Data)
 
static void GpioExtInitPcal (const struct gpio_ext_t *GpioExt)
 Initialize I2C-based IO expander type NXP PCAL9535A. More...
 
static void GpioExtDisablePcal (const struct gpio_ext_t *GpioExt)
 De-initialize I2C-based IO expander type NXP PCAL9535A. More...
 
static uint16_t GpioExtInPortPcal (const struct gpio_ext_t *GpioExt)
 Name: GpioExtInPortPcal
Read 16-bits data from GPIO port. More...
 
static void GpioExtOutPortPcal (const struct gpio_ext_t *GpioExt, uint16_t Data)
 Name: GpioExtOutPortPcal
Write 16-bits data to GPIO port. More...
 
static void GpioExtSetDirectionPcal (const struct gpio_ext_t *GpioExt, uint16_t Direction)
 Set pins direction to GPIO port. More...
 
static void GpioExtSetPullSelectPcal (const struct gpio_ext_t *GpioExt, uint16_t PullSelect)
 Select pullup or pulldown for GPIO port. More...
 
static void GpioExtSetPullEnablePcal (const struct gpio_ext_t *GpioExt, uint16_t PullEnable)
 Enable pullup/pulldown to GPIO port. More...
 
static void GpioExtSetInterruptsPcal (const struct gpio_ext_t *GpioExt, uint16_t Mask)
 
static void GpioExtSetLatchPcal (const struct gpio_ext_t *GpioExt, uint16_t Mask)
 
void GpioExtSetDrivePcal (const struct gpio_ext_t *GpioExt, uint8_t Values[])
 

Detailed Description

This driver supports the I2C-based IO expander type NXP PCAL9535A. The IO expander has 2 8-bits IO ports, 1 open drain interrupt output and 3 address lines. Both IO ports are operated as one common 16-bits port with PORT1 as MSByte and PORT0 as LSByte. The I2C address range is 0x20 - 0x27. Max baudrate is 400 kbit/s. The port bits could be set to inputs or outputs individually. Each input can be configured to have pullup or pulldown resistors.

The selected I2C port must be initialized before using the driver.

Function Documentation

static void GpioExtInitPcal ( const struct gpio_ext_t GpioExt)
inlinestatic

Initialize I2C-based IO expander type NXP PCAL9535A.

Parameters
GpioExtParameters for the IO port expander to be used

Definition at line 131 of file gpio-ext-pcal9535a.h.

static void GpioExtDisablePcal ( const struct gpio_ext_t GpioExt)
inlinestatic

De-initialize I2C-based IO expander type NXP PCAL9535A.

Parameters
GpioExtParameters for the IO port expander to be used
Returns
true if OK, else false

Definition at line 142 of file gpio-ext-pcal9535a.h.

static uint16_t GpioExtInPortPcal ( const struct gpio_ext_t GpioExt)
inlinestatic

Name: GpioExtInPortPcal
Read 16-bits data from GPIO port.

Parameters
GpioExtParameters for the IO port expander to be used
Returns
Data read

Definition at line 154 of file gpio-ext-pcal9535a.h.

static void GpioExtOutPortPcal ( const struct gpio_ext_t GpioExt,
uint16_t  Data 
)
inlinestatic

Name: GpioExtOutPortPcal
Write 16-bits data to GPIO port.

Parameters
GpioExtParameters for the IO port expander to be used
DataData to be written to IO expander ports

Definition at line 166 of file gpio-ext-pcal9535a.h.

static void GpioExtSetDirectionPcal ( const struct gpio_ext_t GpioExt,
uint16_t  Direction 
)
inlinestatic

Set pins direction to GPIO port.

Parameters
GpioExtParameters for the IO port expander to be used
DirectionNew direction to be settled

Definition at line 177 of file gpio-ext-pcal9535a.h.

static void GpioExtSetPullSelectPcal ( const struct gpio_ext_t GpioExt,
uint16_t  PullSelect 
)
inlinestatic

Select pullup or pulldown for GPIO port.

Parameters
GpioExtParameters for the IO port expander to be used
PullSelect0 - pulldown, 1 - pullup

Definition at line 190 of file gpio-ext-pcal9535a.h.

static void GpioExtSetPullEnablePcal ( const struct gpio_ext_t GpioExt,
uint16_t  PullEnable 
)
inlinestatic

Enable pullup/pulldown to GPIO port.

Parameters
GpioExtParameters for the IO port expander to be used
PullEnable0 - disable, 1 - enable

Definition at line 202 of file gpio-ext-pcal9535a.h.

References gpio_ext_state_t::InterruptMask, and gpio_ext_t::State.

Variable Documentation

const struct gpio_ext_api_t GpioPcalFunc

Pointer to GpioPcalFunc structure uses to initialize the array of GPIO virtual functions .Func in struct ext_gpio_t GPIO descriptor.