expand6 2.0.0.0
Public function

Functions

void expand6_cfg_setup (expand6_cfg_t *cfg)
 Config Object Initialization function.
 
EXPAND6_RETVAL expand6_init (expand6_t *ctx, expand6_cfg_t *cfg)
 Initialization function.
 
void expand6_generic_write (expand6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void expand6_generic_read (expand6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void expand6_write_byte (expand6_t *ctx, uint8_t reg_adr, uint8_t wr_data)
 Write byte function.
 
uint8_t expand6_read_byte (expand6_t *ctx, uint8_t reg_adr)
 Read byte function.
 
void expand6_write_port_exp (expand6_t *ctx, uint8_t reg, uint8_t *buf, uint8_t len)
 Port Expander Write function.
 
void expand6_read_port_exp (expand6_t *ctx, uint8_t reg, uint8_t *buf, uint8_t len)
 Port Expander Read function.
 
void expand6_send_eeprom_cmd (expand6_t *ctx, uint8_t cmd)
 Send Command function.
 
void expand6_write_eeprom (expand6_t *ctx, uint16_t mem_adr, uint8_t *buf, uint8_t len)
 EEPROM Write function.
 
void expand6_read_eeprom (expand6_t *ctx, uint16_t mem_adr, uint8_t *buf, uint8_t len)
 EEPROM Read function.
 
uint8_t expand6_read_bit (expand6_t *ctx, uint8_t reg_adr, uint8_t bit_num)
 Read bit function.
 
void expand6_write_bit (expand6_t *ctx, uint8_t reg_adr, uint8_t bit_num, uint8_t pin_val)
 Write bit function.
 
uint8_t expand6_read_pin (expand6_t *ctx, uint16_t pin, uint8_t inv)
 Get a single INPUT pin's logic level function.
 
uint8_t expand6_read_port (expand6_t *ctx, uint8_t port, uint8_t inv)
 Get all pin logic levels from one port function.
 
uint8_t expand6_get_pin_out_lvl (expand6_t *ctx, uint16_t pin)
 Get a single OUTPUT pin's setting function.
 
uint8_t expand6_get_port_out_lvl (expand6_t *ctx, uint8_t port)
 Get all pin output settings from one port function.
 
void expand6_write_pin (expand6_t *ctx, uint16_t pin, uint8_t pin_val)
 Set a single OUTPUT pin's logic level function.
 
void expand6_write_port (expand6_t *ctx, uint8_t port, uint8_t value)
 Set all OUTPUT pins' logic levels in one port function.
 
void expand6_sel_pwm_pin (expand6_t *ctx, uint16_t pin, uint8_t pwm_en)
 Select a PWM output pin function.
 
void expand6_pwm_cfg (expand6_t *ctx, expand6_pwm_cfg_t pwm_cfg, float *duty_cyc, float *freq)
 PWM Configuration function.
 
void expand6_eeprom_enable (expand6_t *ctx, uint8_t cmd)
 Enable Register Configuration function.
 
void expand6_reset (expand6_t *ctx)
 Reset function.
 
uint8_t expand6_check_int (expand6_t *ctx)
 Get Interrupt state function.
 

Detailed Description

Function Documentation

◆ expand6_cfg_setup()

void expand6_cfg_setup ( expand6_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.

◆ expand6_check_int()

uint8_t expand6_check_int ( expand6_t * ctx)

Get Interrupt state function.

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

Function is used to check if an interrupt has occured.

◆ expand6_eeprom_enable()

void expand6_eeprom_enable ( expand6_t * ctx,
uint8_t cmd )

Enable Register Configuration function.

Parameters
ctxClick object.
cmdvalue that represents input data to Enable Register

Function is used to write to Enable Register.

Note
Writes to this register differ from other registers, consult datasheet for further information.

◆ expand6_generic_read()

void expand6_generic_read ( expand6_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.

◆ expand6_generic_write()

void expand6_generic_write ( expand6_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.

◆ expand6_get_pin_out_lvl()

uint8_t expand6_get_pin_out_lvl ( expand6_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.

◆ expand6_get_port_out_lvl()

uint8_t expand6_get_port_out_lvl ( expand6_t * ctx,
uint8_t port )

Get all pin output settings from one port function.

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

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

◆ expand6_init()

EXPAND6_RETVAL expand6_init ( expand6_t * ctx,
expand6_cfg_t * cfg )

Initialization function.

Parameters
expand6Click object.
cfgClick configuration structure.

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

◆ expand6_pwm_cfg()

void expand6_pwm_cfg ( expand6_t * ctx,
expand6_pwm_cfg_t pwm_cfg,
float * duty_cyc,
float * freq )

PWM Configuration function.

Parameters
ctxClick object.
expand6_pwm_cfg_tstructure where PWM Configuration data are stored.
duty_cycfloat value representing PWM duty cycle
freqfloat value representing output frequency

Function is used to configure PWM output.

◆ expand6_read_bit()

uint8_t expand6_read_bit ( expand6_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.

◆ expand6_read_byte()

uint8_t expand6_read_byte ( expand6_t * ctx,
uint8_t reg_adr )

Read byte function.

Parameters
ctxClick object.
reg_adr8-bit value that defines the register
Returns
rx_buf 8-bit value that defines the output data

Function is used to read single byte of data from user defined register.

◆ expand6_read_eeprom()

void expand6_read_eeprom ( expand6_t * ctx,
uint16_t mem_adr,
uint8_t * buf,
uint8_t len )

EEPROM Read function.

Parameters
ctxClick object.
reg8-bit register address
buf8-bit read data
len8-bit number of bytes

Reads user defined number of bytes from EEPROM defined by 8-bit address

◆ expand6_read_pin()

uint8_t expand6_read_pin ( expand6_t * ctx,
uint16_t pin,
uint8_t inv )

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.

◆ expand6_read_port()

uint8_t expand6_read_port ( expand6_t * ctx,
uint8_t port,
uint8_t inv )

Get all pin logic levels from one port function.

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

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

◆ expand6_read_port_exp()

void expand6_read_port_exp ( expand6_t * ctx,
uint8_t reg,
uint8_t * buf,
uint8_t len )

Port Expander Read function.

Parameters
ctxClick object.
reg8-bit register address
buf8-bit read data
len8-bit number of bytes

Reads user defined number of bytes from registers defined by 8-bit register address

◆ expand6_reset()

void expand6_reset ( expand6_t * ctx)

Reset function.

Parameters
ctxClick object.

Function is used to reset the device.

Note
Functon holds two 100 ms reset delays.

◆ expand6_sel_pwm_pin()

void expand6_sel_pwm_pin ( expand6_t * ctx,
uint16_t pin,
uint8_t pwm_en )

Select a PWM output pin function.

Parameters
ctxClick object.
port8-bit value that defines PWM output pin.
value8-bit value that enables or disables PWM output (0 or 1 for each pin).

Function is used to enable or disable PWM output on a specific pin.

◆ expand6_send_eeprom_cmd()

void expand6_send_eeprom_cmd ( expand6_t * ctx,
uint8_t cmd )

Send Command function.

Parameters
ctxClick object.
cmd8-bit value that defines the command

Function is used to send the command to Command Register.

◆ expand6_write_bit()

void expand6_write_bit ( expand6_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.

◆ expand6_write_byte()

void expand6_write_byte ( expand6_t * ctx,
uint8_t reg_adr,
uint8_t wr_data )

Write byte function.

Parameters
ctxClick object.
reg_adr8-bit value that defines the register
wr_data8-bit value that defines the input data

Function is used to write single byte of data into user defined register.

◆ expand6_write_eeprom()

void expand6_write_eeprom ( expand6_t * ctx,
uint16_t mem_adr,
uint8_t * buf,
uint8_t len )

EEPROM Write function.

Parameters
ctxClick object.
reg8-bit register address
wr_data8-bit write data
len8-bit number of bytes

Writes user defined number of bytes into EEPROM defined by 8-bit address

◆ expand6_write_pin()

void expand6_write_pin ( expand6_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.

◆ expand6_write_port()

void expand6_write_port ( expand6_t * ctx,
uint8_t port,
uint8_t value )

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

Parameters
ctxClick object.
port8-bit value that defines which port to write to.
value8-bit value that defines pins' output logic level (0 or 1 for each pin).

Function is used to set logic levels in one port.

◆ expand6_write_port_exp()

void expand6_write_port_exp ( expand6_t * ctx,
uint8_t reg,
uint8_t * buf,
uint8_t len )

Port Expander Write function.

Parameters
ctxClick object.
reg8-bit register address
buf8-bit write data
len8-bit number of bytes

Writes user defined number of bytes into registers defined by 8-bit register address