EVE 1.0
io-expander-pcal9535a.h File Reference

Driver for I2C-based IO expander type NXP PCAL9535A. More...

#include <stdbool.h>
#include <string.h>
Include dependency graph for io-expander-pcal9535a.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  io_expander_state_t
 
struct  io_expander_t
 

Functions

Functions called from application programs
bool IoExpanderRead (const struct io_expander_t *IoExpander, const uint8_t Address, uint16_t *Data)
 
bool IoExpanderWrite (const struct io_expander_t *IoExpander, const uint8_t Address, const uint16_t Data)
 
bool IoExpPortInit (const struct io_expander_t *IoExpander)
 Name: IoExpPortInit
Initializes I2C-based IO expander type NXP PCAL9535A. More...
 
bool IoExpPortRead (const struct io_expander_t *IoExpander, uint16_t *In)
 Name: IoExpPortRead
Read 16-bits data from IO expander ports. More...
 
bool IoExpPortWrite (const struct io_expander_t *IoExpander, const uint16_t Out, const uint16_t Mask)
 
uint16_t IoExpPortInterruptsRead (const struct io_expander_t *IoExpander)
 Name: IoExpPortInterruptsRead
Read and clear interrupt status from the IO expander. More...
 
bool IoExpPortInterruptsEnable (const struct io_expander_t *IoExpander, uint16_t Mask)
 Name: IoExpPortInterruptsEnable
Enable (unmask) interrupts for the selected set of pins. More...
 
bool IoExpPortInterruptsDisable (const struct io_expander_t *IoExpander, uint16_t Mask)
 Name: IoExpPortInterruptsDisable
Disable (mask) interrupts for the selected set of pins. More...
 
void IoExpPortInterruptsClear (const struct io_expander_t *IoExpander, uint16_t Mask)
 Name: IoExpPortInterruptsDisable
Clear (remove pending status) interrupts for the selected set of pins. More...
 
static bool IoExpPortSet (const struct io_expander_t *IoExpander, const uint16_t SetBits)
 Name: IoExpPortSet
Sets IO expander port bits. More...
 
static bool IoExpPortClear (const struct io_expander_t *IoExpander, const uint16_t ClearBits)
 Name: IoExpPortClear
Clears IO expander port bits. More...
 
static bool IoExpPortDirection (const struct io_expander_t *IoExpander, const uint16_t Direction)
 Name: IoExpPortDirection
Set IO expander ports to input and output. More...
 
static bool IoExpPortDriveSet (const struct io_expander_t *IoExpander, const uint32_t Drive)
 Name: IoExpPortDriveSet
Set output drive strength for IO expander ports. More...
 
static bool IoExpPortPullResistorSet (const struct io_expander_t *IoExpander, const uint16_t PullEnable, const uint16_t PullSelect)
 Name: IoExpPortPullResistorSet
Disables/enables pullup/pulldown resistors for IO expander port pins. More...
 

Detailed Description

Driver for I2C-based IO expander type NXP PCAL9535A.

Author
KLO, Jetro AS

Definition in file io-expander-pcal9535a.h.

Function Documentation

bool IoExpPortInit ( const struct io_expander_t IoExpander)

Name: IoExpPortInit
Initializes I2C-based IO expander type NXP PCAL9535A.

Parameters
IoExpanderParameters for the IO port expander to be used
Returns
true if OK, else false
bool IoExpPortRead ( const struct io_expander_t IoExpander,
uint16_t *  In 
)

Name: IoExpPortRead
Read 16-bits data from IO expander ports.

Parameters
IoExpanderParameters for the IO port expander to be used
InPointer to put data read from IO expander ports
Returns
true if OK, else false
uint16_t IoExpPortInterruptsRead ( const struct io_expander_t IoExpander)

Name: IoExpPortInterruptsRead
Read and clear interrupt status from the IO expander.

Parameters
IoExpanderParameters for the IO port expander to be used
Returns
bit mask with bits set for every unmasked pending interrupt
bool IoExpPortInterruptsEnable ( const struct io_expander_t IoExpander,
uint16_t  Mask 
)

Name: IoExpPortInterruptsEnable
Enable (unmask) interrupts for the selected set of pins.

Parameters
IoExpanderParameters for the IO port expander to be used
MaskPin bitmap
Returns
true if OK, else false
bool IoExpPortInterruptsDisable ( const struct io_expander_t IoExpander,
uint16_t  Mask 
)

Name: IoExpPortInterruptsDisable
Disable (mask) interrupts for the selected set of pins.

Parameters
IoExpanderParameters for the IO port expander to be used
MaskPin bitmap
Returns
true if OK, else false
void IoExpPortInterruptsClear ( const struct io_expander_t IoExpander,
uint16_t  Mask 
)

Name: IoExpPortInterruptsDisable
Clear (remove pending status) interrupts for the selected set of pins.

Parameters
IoExpanderParameters for the IO port expander to be used
MaskPin bitmap
Returns
true if OK, else false
static bool IoExpPortSet ( const struct io_expander_t IoExpander,
const uint16_t  SetBits 
)
inlinestatic

Name: IoExpPortSet
Sets IO expander port bits.

Parameters
IoExpanderParameters for the IO port expander to be used
SetBitsBits to be set at IO expander ports
Returns
true if OK, else false

Definition at line 202 of file io-expander-pcal9535a.h.

References IoExpPortWrite().

static bool IoExpPortClear ( const struct io_expander_t IoExpander,
const uint16_t  ClearBits 
)
inlinestatic

Name: IoExpPortClear
Clears IO expander port bits.

Parameters
IoExpanderParameters for the IO port expander to be used
ClearBitsBits to be cleared at IO expander ports
Returns
true if OK, else false

Definition at line 216 of file io-expander-pcal9535a.h.

References IoExpPortWrite().

static bool IoExpPortDirection ( const struct io_expander_t IoExpander,
const uint16_t  Direction 
)
inlinestatic

Name: IoExpPortDirection
Set IO expander ports to input and output.

Parameters
IoExpanderParameters for the IO port expander to be used
Direction0 = output, 1 = input
Returns
true if OK, else false

Definition at line 230 of file io-expander-pcal9535a.h.

References io_expander_state_t::Direction, and io_expander_t::State.

static bool IoExpPortDriveSet ( const struct io_expander_t IoExpander,
const uint32_t  Drive 
)
inlinestatic

Name: IoExpPortDriveSet
Set output drive strength for IO expander ports.

Parameters
IoExpanderParameters for the IO port expander to be used
DriveOutput drive strength data for the port bits 00 = 25%, 01 = 50%, 10 = 75%, 11 = 100% for each bit
Returns
true if OK, else false

Definition at line 246 of file io-expander-pcal9535a.h.

static bool IoExpPortPullResistorSet ( const struct io_expander_t IoExpander,
const uint16_t  PullEnable,
const uint16_t  PullSelect 
)
inlinestatic

Name: IoExpPortPullResistorSet
Disables/enables pullup/pulldown resistors for IO expander port pins.

Parameters
IoExpanderParameters for the IO port expander to be used
PullEnableEnable pull resistors for port pins 0 = disable, 1 = enable
PullSelectSets pullup or polldown resistors for port pins 0 = 100k pulldown, 1 = 100k pullup
Returns
true if OK, else false

Definition at line 267 of file io-expander-pcal9535a.h.