expand5 2.0.0.0
Public function

Functions

void expand5_cfg_setup (expand5_cfg_t *cfg)
 Config Object Initialization function.
 
EXPAND5_RETVAL expand5_init (expand5_t *ctx, expand5_cfg_t *cfg)
 Initialization function.
 
void expand5_generic_write (expand5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void expand5_generic_read (expand5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint8_t expand5_read_bit (expand5_t *ctx, uint8_t reg_adr, uint8_t bit_num)
 Read bit function.
 
void expand5_write_bit (expand5_t *ctx, uint8_t reg_adr, uint8_t bit_num, uint8_t pin_val)
 Write bit function.
 
uint8_t expand5_read_pin (expand5_t *ctx, uint16_t pin)
 Get a single INPUT pin's logic level function.
 
uint8_t expand5_read_bank (expand5_t *ctx, uint8_t bank)
 Get all pin logic levels from one bank function.
 
void expand5_read_all_banks (expand5_t *ctx, uint8_t *bank0, uint8_t *bank1, uint8_t *bank2)
 Get all pins logic levels from all banks function.
 
uint8_t expand5_get_pin_out_lvl (expand5_t *ctx, uint16_t pin)
 Get a single OUTPUT pin's setting function.
 
uint8_t expand5_get_bank_out_lvl (expand5_t *ctx, uint8_t bank)
 Get all pin output settings from one bank function.
 
void expand5_get_all_banks_out_lvl (expand5_t *ctx, uint8_t *bank0, uint8_t *bank1, uint8_t *bank2)
 Get all pin output settings from all banks function.
 
void expand5_write_pin (expand5_t *ctx, uint16_t pin, uint8_t pin_val)
 Set a single OUTPUT pin's logic level function.
 
void expand5_write_bank (expand5_t *ctx, uint8_t bank, uint8_t value)
 Set all OUTPUT pins' logic levels in one bank function.
 
void expand5_write_all_banks (expand5_t *ctx, uint8_t bank0, uint8_t bank1, uint8_t bank2)
 Set all OUTPUT pins' logic levels in all banks function.
 
uint8_t expand5_get_pin_pol (expand5_t *ctx, uint16_t pin)
 Get a single pin's polarity ( normal/inverted ) setting function.
 
uint8_t expand5_get_bank_pol (expand5_t *ctx, uint8_t bank)
 Get all pin polarity ( normal/inverted ) settings from one bank function.
 
void expand5_get_all_banks_pol (expand5_t *ctx, uint8_t *bank0, uint8_t *bank1, uint8_t *bank2)
 Get all pin polarity ( normal/inverted ) settings from all banks function.
 
void expand5_set_pin_pol (expand5_t *ctx, uint16_t pin, uint8_t polarity)
 Set a single pin's polarity ( normal/inverted ) setting function.
 
void expand5_set_bank_pol (expand5_t *ctx, uint8_t bank, uint8_t polarity)
 Set all pin polarity ( normal/inverted ) settings in one bank function.
 
void expand5_set_all_banks_pol (expand5_t *ctx, uint8_t bank0, uint8_t bank1, uint8_t bank2)
 Set all pin polarity ( normal/inverted ) settings in all banks function.
 
uint8_t expand5_get_pin_dir (expand5_t *ctx, uint16_t pin)
 Get a single pin's direction ( I/O ) setting function.
 
uint8_t expand5_get_bank_dir (expand5_t *ctx, uint8_t bank)
 Get all pin direction ( I/O ) settings from one bank function.
 
void expand5_get_all_dir (expand5_t *ctx, uint8_t *bank0, uint8_t *bank1, uint8_t *bank2)
 Get all pin direction ( I/O ) settings from all banks function.
 
void expand5_set_pin_dir (expand5_t *ctx, uint16_t pin, uint8_t direction)
 Set a single pin's direction ( I/O ) setting function.
 
void expand5_set_bank_dir (expand5_t *ctx, uint8_t bank, uint8_t direction)
 Set all pin direction ( I/O ) settings in one bank function.
 
void expand5_set_all_dir (expand5_t *ctx, uint8_t bank0, uint8_t bank1, uint8_t bank2)
 Set all pin direction ( I/O ) settings in all banks function.
 
void expand5_reset (expand5_t *ctx)
 Reset function.
 
uint8_t expand5_check_int (expand5_t *ctx)
 Get Interrupt state function.
 

Detailed Description

Function Documentation

◆ expand5_cfg_setup()

void expand5_cfg_setup ( expand5_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ expand5_check_int()

uint8_t expand5_check_int ( expand5_t * ctx)

Get Interrupt state function.

Parameters
ctxClick object.
Returns
  • 1 : Interrupt has not occured
  • 0 : Interrupt has occured

Function is used to check if an interrupt has occured.

◆ expand5_generic_read()

void expand5_generic_read ( expand5_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function reads data from the desired register.

◆ expand5_generic_write()

void expand5_generic_write ( expand5_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ expand5_get_all_banks_out_lvl()

void expand5_get_all_banks_out_lvl ( expand5_t * ctx,
uint8_t * bank0,
uint8_t * bank1,
uint8_t * bank2 )

Get all pin output settings from all banks function.

Parameters
ctxClick object.
bank08-bit value that represents the pin output setting of the first bank
bank18-bit value that represents the pin output setting of the second bank
bank28-bit value that represents the pin output setting of the third bank

Function is used to get all pin output settings from all banks.

Note
Note that this returns the level set in the flip-flop, and does not necessarily represent the actual logic level present at the pin.

◆ expand5_get_all_banks_pol()

void expand5_get_all_banks_pol ( expand5_t * ctx,
uint8_t * bank0,
uint8_t * bank1,
uint8_t * bank2 )

Get all pin polarity ( normal/inverted ) settings from all banks function.

Parameters
ctxClick object.
bank08-bit value that represents the pin polarity settings of the first bank
bank18-bit value that represents the pin polarity settings of the second bank
bank28-bit value that represents the pin polarity settings of the third bank

Function is used to get polarity settings from all banks.

◆ expand5_get_all_dir()

void expand5_get_all_dir ( expand5_t * ctx,
uint8_t * bank0,
uint8_t * bank1,
uint8_t * bank2 )

Get all pin direction ( I/O ) settings from all banks function.

Parameters
ctxClick object.
bank08-bit value that represents pins' direction settings of the first bank
bank18-bit value that represents pins' direction settings of the second bank
bank28-bit value that represents pins' direction settings of the third bank

Function is used to get all pins direction settings from all banks.

◆ expand5_get_bank_dir()

uint8_t expand5_get_bank_dir ( expand5_t * ctx,
uint8_t bank )

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

Parameters
ctxClick object.
bank8-bit value that defines which bank to read ( 0/1/2 for P0*, P1*, P2* respectively )
Returns
direction settings (0 or 1) for each pin in the bank.

Function is used to get all pins direction settings from one bank.

◆ expand5_get_bank_out_lvl()

uint8_t expand5_get_bank_out_lvl ( expand5_t * ctx,
uint8_t bank )

Get all pin output settings from one bank function.

Parameters
ctxClick object.
bank8-bit value that defines the bank
Returns
Pin output setting (0 or 1)

Function is used to get all pin output settings from one bank.

Note
Note that this returns the level set in the flip-flop, and does not necessarily represent the actual logic level present at the pin.

◆ expand5_get_bank_pol()

uint8_t expand5_get_bank_pol ( expand5_t * ctx,
uint8_t bank )

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

Parameters
ctxClick object.
bank8-bit value that defines which bank to read ( 0/1/2 for P0*, P1*, P2* respectively )
Returns
8 pins' polarity settings (0 or 1 for each pin)

Function is used to get polarity settings from one bank.

◆ expand5_get_pin_dir()

uint8_t expand5_get_pin_dir ( expand5_t * ctx,
uint16_t pin )

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

Parameters
ctxClick object.
pin16-bit value that defines the specific pin
Returns
Pin direction setting (0 for output or 1 for input)

Function is used to get a single pin's direction ( I/O ) setting.

◆ expand5_get_pin_out_lvl()

uint8_t expand5_get_pin_out_lvl ( expand5_t * ctx,
uint16_t pin )

Get a single OUTPUT pin's setting function.

Parameters
ctxClick object.
pin16-bit value that defines the specific pin
Returns
Pin output setting (0 or 1)

Function is used to get a single OUTPUT pin's setting.

Note
Note that this returns the level set in the flip-flop, and does not necessarily represent the actual logic level present at the pin..

◆ expand5_get_pin_pol()

uint8_t expand5_get_pin_pol ( expand5_t * ctx,
uint16_t pin )

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

Parameters
ctxClick object.
pin16-bit value that defines the specific pin
Returns
single pin's polarity setting (0 or 1)

Function is used to get a single pin's polarity.

◆ expand5_init()

EXPAND5_RETVAL expand5_init ( expand5_t * ctx,
expand5_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ expand5_read_all_banks()

void expand5_read_all_banks ( expand5_t * ctx,
uint8_t * bank0,
uint8_t * bank1,
uint8_t * bank2 )

Get all pins logic levels from all banks function.

Parameters
ctxClick object.
bank08-bit value that represents the states of pins in first bank
bank18-bit value that represents the states of pins in second bank
bank28-bit value that represents the states of pins in third bank

Function is used to read the states of pins in all banks.

◆ expand5_read_bank()

uint8_t expand5_read_bank ( expand5_t * ctx,
uint8_t bank )

Get all pin logic levels from one bank function.

Parameters
ctxClick object.
bank8-bit value that defines the bank
Returns
8-bit value that represents the states of pins in selected bank.

Function is used to read the states of pins in selected bank.

◆ expand5_read_bit()

uint8_t expand5_read_bit ( expand5_t * ctx,
uint8_t reg_adr,
uint8_t bit_num )

Read bit function.

Parameters
ctxClick object.
reg_adr8-bit value that defines the register
bit_num8-bit value that defines the specific bit
Returns
8-bit value that represents the specific bit's value

Function is used to read state of a single bit of data from user defined register.

◆ expand5_read_pin()

uint8_t expand5_read_pin ( expand5_t * ctx,
uint16_t pin )

Get a single INPUT pin's logic level function.

Parameters
ctxClick object.
pin16-bit value that defines the specific pin
Returns
8-bit value that represents the specific pin's state

Function is used to read the state of a defined pin.

◆ expand5_reset()

void expand5_reset ( expand5_t * ctx)

Reset function.

Parameters
ctxClick object.

Function is used to reset the device.

Note
Functon holds two 100 ms reset delays.

◆ expand5_set_all_banks_pol()

void expand5_set_all_banks_pol ( expand5_t * ctx,
uint8_t bank0,
uint8_t bank1,
uint8_t bank2 )

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

Parameters
ctxClick object.
bank08-bit value that defines the new pin polarity settings of the first bank
bank18-bit value that defines the new pin polarity settings of the second bank
bank28-bit value that defines the new pin polarity settings of the third bank

Function is used to set a pin polarity settings in all banks.

◆ expand5_set_all_dir()

void expand5_set_all_dir ( expand5_t * ctx,
uint8_t bank0,
uint8_t bank1,
uint8_t bank2 )

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

Parameters
ctxClick object.
bank08-bit value that defines pins' new direction settings of the first bank
bank18-bit value that defines pins' new direction settings of the second bank
bank28-bit value that defines pins' new direction settings of the third bank

Function is used to set pins' direction ( I/O ) setting in all banks.

◆ expand5_set_bank_dir()

void expand5_set_bank_dir ( expand5_t * ctx,
uint8_t bank,
uint8_t direction )

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

Parameters
ctxClick object.
bank8-bit value that defines which bank to write to ( 0/1/2 for P0*, P1*, P2* respectively )
directionpins' direction settings (0 or 1) for each pin.

Function is used to set pins' direction ( I/O ) setting in one bank.

◆ expand5_set_bank_pol()

void expand5_set_bank_pol ( expand5_t * ctx,
uint8_t bank,
uint8_t polarity )

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

Parameters
ctxClick object.
bank8-bit value that defines which bank to write to (0/1/2 for P0*, P1*, P2* respectively)
polarity8-bit value that defines new pins' polarity settings (0 or 1 for each pin)

Function is used to set a pin polarity settings in one bank.

◆ expand5_set_pin_dir()

void expand5_set_pin_dir ( expand5_t * ctx,
uint16_t pin,
uint8_t direction )

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

Parameters
ctxClick object.
pin16-bit value that defines the specific pin
directionpin's direction setting (0 or 1)

Function is used to set a single pin's direction ( I/O ) setting.

◆ expand5_set_pin_pol()

void expand5_set_pin_pol ( expand5_t * ctx,
uint16_t pin,
uint8_t polarity )

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

Parameters
ctxClick object.
pin16-bit value that defines the specific pin
polaritypin polarity setting (0 or 1)

Function is used to set a single pin's polarity.

◆ expand5_write_all_banks()

void expand5_write_all_banks ( expand5_t * ctx,
uint8_t bank0,
uint8_t bank1,
uint8_t bank2 )

Set all OUTPUT pins' logic levels in all banks function.

Parameters
ctxClick object.
bank08-bit value that defines the first bank's new logic values
bank18-bit value that defines the second bank's new logic values
bank28-bit value that defines the third bank's new logic values

Function is used to set logic levels in all banks.

◆ expand5_write_bank()

void expand5_write_bank ( expand5_t * ctx,
uint8_t bank,
uint8_t value )

Set all OUTPUT pins' logic levels in one bank function.

Parameters
ctxClick object.
bank8-bit value that defines which bank to write to ( 0/1/2 for P0*, P1*, P2* respectively )
value8-bit value that defines pins' output logic level (0 or 1 for each pin).

Function is used to set logic levels in one bank.

◆ expand5_write_bit()

void expand5_write_bit ( expand5_t * ctx,
uint8_t reg_adr,
uint8_t bit_num,
uint8_t pin_val )

Write bit function.

Parameters
ctxClick object.
reg_adr8-bit value that defines the register
bit_num8-bit value that defines the specific bit
pin_val8-bit value that defines the specific bit's value

Function is used to set or clear the specific bit.

◆ expand5_write_pin()

void expand5_write_pin ( expand5_t * ctx,
uint16_t pin,
uint8_t pin_val )

Set a single OUTPUT pin's logic level function.

Parameters
ctxClick object.
pin8-bit value that defines the specific pin
pin_val8-bit value that defines the specific pin's value

Function is used to set a single output pin's logic level.