expand8 2.0.0.0
Expand 8 Click Driver

API for configuring and manipulating Expand 8 Click driver. More...

Topics

 Expand 8 Registers Settings
 Settings for registers of Expand 8 Click driver.
 
 Expand 8 MikroBUS Map
 MikroBUS pin mapping of Expand 8 Click driver.
 

Functions

void expand8_cfg_setup (expand8_cfg_t *cfg)
 Expand 8 configuration object setup function.
 
err_t expand8_init (expand8_t *ctx, expand8_cfg_t *cfg)
 Expand 8 initialization function.
 
err_t expand8_generic_write (expand8_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Expand 8 data writing function.
 
err_t expand8_generic_read (expand8_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Expand 8 data reading function.
 
void expand8_write_data (expand8_t *ctx, uint8_t addr, uint8_t tx_data)
 Generic write data function.
 
uint8_t expand8_read_data (expand8_t *ctx, uint8_t addr)
 Generic read data function.
 
err_t expand8_set_port (expand8_t *ctx, uint8_t sel_port, uint8_t sel_imped)
 Set port function.
 

Detailed Description

API for configuring and manipulating Expand 8 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ expand8_cfg_setup()

void expand8_cfg_setup ( expand8_cfg_t * cfg)

Expand 8 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See expand8_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ expand8_generic_read()

err_t expand8_generic_read ( expand8_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Expand 8 data reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See expand8_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ expand8_generic_write()

err_t expand8_generic_write ( expand8_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Expand 8 data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See expand8_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ expand8_init()

err_t expand8_init ( expand8_t * ctx,
expand8_cfg_t * cfg )

Expand 8 initialization function.

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

Parameters
[out]ctx: Click context object. See expand8_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See expand8_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ expand8_read_data()

uint8_t expand8_read_data ( expand8_t * ctx,
uint8_t addr )

Generic read data function.

The function read the the byte of data from the target 8-bit register address of the MAX7317, 10-Port SPI-Interfaced I/O Expander with Overvoltage and Hot-Insertion Protection on Expand 8 click boar.

Parameters
[in]ctx: Click context object. See expand8_t object definition for detailed explanation.
[in]addr: 7-bit Command Address.
Returns
8-bit read data.

◆ expand8_set_port()

err_t expand8_set_port ( expand8_t * ctx,
uint8_t sel_port,
uint8_t sel_imped )

Set port function.

The function set and configur the target port of the MAX7317, 10-Port SPI-Interfaced I/O Expander with Overvoltage and Hot-Insertion Protection on Expand 8 click board.

Parameters
[in]ctx: Click context object. See expand8_t object definition for detailed explanation.
sel_port: Selected Port [ 0 : 9 ].
sel_imped: Selected Impedance.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ expand8_write_data()

void expand8_write_data ( expand8_t * ctx,
uint8_t addr,
uint8_t tx_data )

Generic write data function.

The function write the byte of data to the target 8-bit register address of the MAX7317, 10-Port SPI-Interfaced I/O Expander with Overvoltage and Hot-Insertion Protection on Expand 8 click board.

Parameters
[in]ctx: Click context object. See expand8_t object definition for detailed explanation.
[in]addr: 7-bit Command Address.
[in]tx_data: Byte of data to write.
Returns
Nothing.