expand2 2.0.0.0
Public function

Functions

void expand2_cfg_setup (expand2_cfg_t *cfg)
 Config Object Initialization function.
 
EXPAND2_RETVAL expand2_init (expand2_t *ctx, expand2_cfg_t *cfg)
 Initialization function.
 
void expand2_default_cfg (expand2_t *ctx)
 Click Default Configuration function.
 
void expand2_generic_write (expand2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void expand2_generic_read (expand2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void expand2_set_bits (expand2_t *ctx, uint8_t module_address, uint8_t reg_address, uint8_t bit_mask)
 Set register bits function.
 
void expand2_clear_bits (expand2_t *ctx, uint8_t module_address, uint8_t reg_address, uint8_t bit_mask)
 Clear register bits function.
 
void expand2_toggle_bits (expand2_t *ctx, uint8_t module_address, uint8_t reg_address, uint8_t bit_mask)
 Toggle register bits function.
 
uint8_t expand2_read_port_a (expand2_t *ctx, uint8_t module_address)
 Read one byte of data from PORTA function.
 
uint8_t expand2_read_port_b (expand2_t *ctx, uint8_t module_address)
 Read one byte of data from PORTB function.
 
uint16_t expand2_read_both_ports (expand2_t *ctx, uint8_t module_address)
 Read two byte of data from PORTA & PORTB function.
 
void expand2_write_port_a (expand2_t *ctx, uint8_t module_address, uint8_t write_data)
 Write one byte of data to register for PORTA function.
 
void expand2_clear_bit_port_a (expand2_t *ctx, uint8_t moduleAddress, uint8_t bitMask)
 Clear bit from register for PORTA function.
 
void expand2_set_bit_port_a (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Set bit to register for PORTA function.
 
void expand2_toggle_bit_port_a (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Toggle bit to register for PORTA function.
 
void expand2_write_port_b (expand2_t *ctx, uint8_t module_address, uint8_t write_data)
 Write one byte of data to register for PORTB function.
 
void expand2_clear_bit_port_b (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Clear bit from register for PORTB function.
 
void expand2_setBitPortB (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Set bit to register for PORTB function.
 
void expand2_toggle_bit_port_b (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Toggle bit to register for PORTB function.
 
void expand2_set_direction_port_a (expand2_t *ctx, uint8_t module_address, uint8_t write_data)
 Set expander PORTA direction function.
 
void expand2_set_input_dir_port_a (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Set expander PORTA input direction function.
 
void expand2_set_output_dir_port_a (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Set expander PORTA output direction function.
 
void expand2_set_direction_port_b (expand2_t *ctx, uint8_t module_address, uint8_t write_data)
 Set expander PORTB direction function.
 
void expand2_set_input_dir_port_b (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Set expander PORTB input direction function.
 
void expand2_set_output_dir_port_b (expand2_t *ctx, uint8_t module_address, uint8_t bit_mask)
 Set expander PORTB output direction function.
 
void expand2_set_pull_ups_port_a (expand2_t *ctx, uint8_t module_address, uint8_t write_data)
 Set pull-ups of the expander for PORTA pins function.
 
void expand2_set_pull_ups_port_b (expand2_t *ctx, uint8_t module_address, uint8_t write_data)
 Set pull-ups of the expander for PORTB pins function.
 
void expand2_set_port_a (expand2_t *ctx, uint8_t module_address, uint8_t position)
 Active pin by position on PORTA function.
 
void expand2_set_port_b (expand2_t *ctx, uint8_t module_address, uint8_t position)
 Active pin by position on PORTB function.
 
void expand2_reset (expand2_t *ctx)
 Reset function.
 
uint8_t expand2_getInterrupt (expand2_t *ctx)
 Get state of interrupt pin function.
 

Detailed Description

Function Documentation

◆ expand2_cfg_setup()

void expand2_cfg_setup ( expand2_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.

◆ expand2_clear_bit_port_a()

void expand2_clear_bit_port_a ( expand2_t * ctx,
uint8_t moduleAddress,
uint8_t bitMask )

Clear bit from register for PORTA function.

Parameters
ctxClick object.
module_addressmodule address
bit_maskbits mask

@description Function clear bit from 8-bit register address from PORTA of MCP23017 chip.

◆ expand2_clear_bit_port_b()

void expand2_clear_bit_port_b ( expand2_t * ctx,
uint8_t module_address,
uint8_t bit_mask )

Clear bit from register for PORTB function.

Parameters
ctxClick object.
module_addressmodule address
bit_maskbits mask

@description Function clear bit from 8-bit register address from PORTB of MCP23017 chip.

◆ expand2_clear_bits()

void expand2_clear_bits ( expand2_t * ctx,
uint8_t module_address,
uint8_t reg_address,
uint8_t bit_mask )

Clear register bits function.

Parameters
ctxClick object.
module_addressmodule address
reg_addressregister address
bit_maskbits mask

@description Function clear bits from 8-bit register address of MCP23017 chip.

◆ expand2_default_cfg()

void expand2_default_cfg ( expand2_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for Expand2 click.

◆ expand2_generic_read()

void expand2_generic_read ( expand2_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.

◆ expand2_generic_write()

void expand2_generic_write ( expand2_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.

◆ expand2_getInterrupt()

uint8_t expand2_getInterrupt ( expand2_t * ctx)

Get state of interrupt pin function.

Parameters
ctxClick object.
Returns
state
  
       0 - No Active
       1 - Active
     

@description Function get state of interrupt ( INT ) pin.

◆ expand2_init()

EXPAND2_RETVAL expand2_init ( expand2_t * ctx,
expand2_cfg_t * cfg )

Initialization function.

Parameters
expand2Click object.
cfgClick configuration structure.

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

◆ expand2_read_both_ports()

uint16_t expand2_read_both_ports ( expand2_t * ctx,
uint8_t module_address )

Read two byte of data from PORTA & PORTB function.

Parameters
ctxClick object.
module_addressmodule address
Returns
result read data ( PORTA & PORTB )

@description Function read 16-bit of data from PORTA & PORTB from 8-bit register address of MCP23017 chip.

◆ expand2_read_port_a()

uint8_t expand2_read_port_a ( expand2_t * ctx,
uint8_t module_address )

Read one byte of data from PORTA function.

Parameters
ctxClick object.
module_addressmodule address
Returns
result read data ( PORTA )

@description Function read 8-bit of data from PORTA from 8-bit register address of MCP23017 chip.

◆ expand2_read_port_b()

uint8_t expand2_read_port_b ( expand2_t * ctx,
uint8_t module_address )

Read one byte of data from PORTB function.

Parameters
ctxClick object.
module_addressmodule address
Returns
result read data ( PORTB )

@description Function read 8-bit of data from PORTB from 8-bit register address of MCP23017 chip.

◆ expand2_reset()

void expand2_reset ( expand2_t * ctx)

Reset function.

Parameters
ctxClick object.
module_addressmodule address
write_datapull up value

@description Function reset Expand 2 click by set RST pin from low to high.

Note
delay is 11ms

◆ expand2_set_bit_port_a()

void expand2_set_bit_port_a ( expand2_t * ctx,
uint8_t module_address,
uint8_t bit_mask )

Set bit to register for PORTA function.

Parameters
ctxClick object.
module_addressmodule address
bit_maskbits mask

@description Function set bit to 8-bit register address from PORTA of MCP23017 chip.

◆ expand2_set_bits()

void expand2_set_bits ( expand2_t * ctx,
uint8_t module_address,
uint8_t reg_address,
uint8_t bit_mask )

Set register bits function.

Parameters
ctxClick object.
module_addressmodule address
reg_addressregister address
bit_maskbits mask

@description Function set bits to 8-bit register address of MCP23017 chip.

◆ expand2_set_direction_port_a()

void expand2_set_direction_port_a ( expand2_t * ctx,
uint8_t module_address,
uint8_t write_data )

Set expander PORTA direction function.

Parameters
ctxClick object.
module_addressmodule address
write_datadata to write

@description Function set expander direction by write 8-bit data to 8-bit register address from PORTA of MCP23017 chip.

◆ expand2_set_direction_port_b()

void expand2_set_direction_port_b ( expand2_t * ctx,
uint8_t module_address,
uint8_t write_data )

Set expander PORTB direction function.

Parameters
ctxClick object.
module_addressmodule address
write_datadata to write

@description Function set expander direction by write 8-bit data to 8-bit register address from PORTB of MCP23017 chip.

◆ expand2_set_input_dir_port_a()

void expand2_set_input_dir_port_a ( expand2_t * ctx,
uint8_t module_address,
uint8_t bit_mask )

Set expander PORTA input direction function.

Parameters
ctxClick object.
module_addressmodule addres
bit_maskbit mask

@description Function write bit, when expander direction of PORTA set as input, to 8-bit register address from PORTA of MCP23017 chip.

◆ expand2_set_input_dir_port_b()

void expand2_set_input_dir_port_b ( expand2_t * ctx,
uint8_t module_address,
uint8_t bit_mask )

Set expander PORTB input direction function.

Parameters
ctxClick object.
module_addressmodule address
bit_maskbit mask

@description Function write bit, when expander direction of PORTB set as input, to 8-bit register address from PORTB of MCP23017 chip.

◆ expand2_set_output_dir_port_a()

void expand2_set_output_dir_port_a ( expand2_t * ctx,
uint8_t module_address,
uint8_t bit_mask )

Set expander PORTA output direction function.

Parameters
ctxClick object.
module_addressmodule address
bit_maskbit mask

@description Function write bit, when expander direction of PORTA set as output, to 8-bit register address from PORTA of MCP23017 chip.

◆ expand2_set_output_dir_port_b()

void expand2_set_output_dir_port_b ( expand2_t * ctx,
uint8_t module_address,
uint8_t bit_mask )

Set expander PORTB output direction function.

Parameters
ctxClick object.
module_addressmodule address
bit_maskbit mask

@description Function write bit, when expander direction of PORTB set as output, to 8-bit register address from PORTB of MCP23017 chip.

◆ expand2_set_port_a()

void expand2_set_port_a ( expand2_t * ctx,
uint8_t module_address,
uint8_t position )

Active pin by position on PORTA function.

Parameters
ctxClick object.
module_addressmodule address
positionpin position

@description Function activate pin on PORTA by position, from PA0 to PA7.

◆ expand2_set_port_b()

void expand2_set_port_b ( expand2_t * ctx,
uint8_t module_address,
uint8_t position )

Active pin by position on PORTB function.

Parameters
ctxClick object.
module_addressmodule address
positionpin position

@description Function activate pin on PORTB by position, from PB0 to PB7.

◆ expand2_set_pull_ups_port_a()

void expand2_set_pull_ups_port_a ( expand2_t * ctx,
uint8_t module_address,
uint8_t write_data )

Set pull-ups of the expander for PORTA pins function.

Parameters
ctxClick object.
module_addressmodule address
write_datapull up value

@description Function set pull-ups of the expander for PORTA pins by write 8-bit pull up value data to 8-bit register address from PORTA of MCP23017 chip.

◆ expand2_set_pull_ups_port_b()

void expand2_set_pull_ups_port_b ( expand2_t * ctx,
uint8_t module_address,
uint8_t write_data )

Set pull-ups of the expander for PORTB pins function.

Parameters
ctxClick object.
module_addressmodule address
write_datapull up value

@description Function set pull-ups of the expander for PORTB pins by write 8-bit pull up value data to 8-bit register address from PORTB of MCP23017 chip.

◆ expand2_setBitPortB()

void expand2_setBitPortB ( expand2_t * ctx,
uint8_t module_address,
uint8_t bit_mask )

Set bit to register for PORTB function.

Parameters
ctxClick object.
module_addressmodule address
bit_maskbits mask

@description Function set bit to 8-bit register address from PORTB of MCP23017 chip.

◆ expand2_toggle_bit_port_a()

void expand2_toggle_bit_port_a ( expand2_t * ctx,
uint8_t module_address,
uint8_t bit_mask )

Toggle bit to register for PORTA function.

Parameters
ctxClick object.
module_addressmodule address
bit_maskbits mask

@description Function toggle bit from 8-bit register address from PORTA of MCP23017 chip.

◆ expand2_toggle_bit_port_b()

void expand2_toggle_bit_port_b ( expand2_t * ctx,
uint8_t module_address,
uint8_t bit_mask )

Toggle bit to register for PORTB function.

Parameters
ctxClick object.
module_addressmodule address
bit_maskbits mask

@description Function toggle bit from 8-bit register address from PORTB of MCP23017 chip.

◆ expand2_toggle_bits()

void expand2_toggle_bits ( expand2_t * ctx,
uint8_t module_address,
uint8_t reg_address,
uint8_t bit_mask )

Toggle register bits function.

Parameters
ctxClick object.
module_addressmodule address
reg_addressregister address
bit_maskbits mask

@description Function toggle bits from 8-bit register address of MCP23017 chip.

◆ expand2_write_port_a()

void expand2_write_port_a ( expand2_t * ctx,
uint8_t module_address,
uint8_t write_data )

Write one byte of data to register for PORTA function.

Parameters
ctxClick object.
module_addressmodule address
write_datadata to write

@description Function write 8-bit of data to 8-bit register address from PORTA of MCP23017 chip.

◆ expand2_write_port_b()

void expand2_write_port_b ( expand2_t * ctx,
uint8_t module_address,
uint8_t write_data )

Write one byte of data to register for PORTB function.

Parameters
ctxClick object.
module_addressmodule address
write_datadata to write

@description Function write 8-bit of data to 8-bit register address from PORTB of MCP23017 chip.