expand3 2.1.0.0
Expand 3 Click Driver

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

Topics

 Expand 3 Commands List
 List of commands of Expand 3 Click driver.
 
 Expand 3 Settings
 Settings of Expand 3 Click driver.
 
 Expand 3 MikroBUS Map
 MikroBUS pin mapping of Expand 3 Click driver.
 

Functions

void expand3_cfg_setup (expand3_cfg_t *cfg)
 Expand 3 configuration object setup function.
 
void expand3_gpio_selection (expand3_cfg_t *cfg, expand3_gpio_sel_t gpio_sel)
 Expand 3 driver interface setup function.
 
err_t expand3_init (expand3_t *ctx, expand3_cfg_t *cfg)
 Expand 3 initialization function.
 
err_t expand3_default_cfg (expand3_t *ctx)
 Expand 3 default configuration function.
 
err_t expand3_check_communication (expand3_t *ctx)
 Expand 3 check communication function.
 
err_t expand3_select_device (expand3_t *ctx)
 Expand 3 select device function.
 
err_t expand3_read_register (expand3_t *ctx, uint16_t reg, uint8_t *data_out)
 Expand 3 read register function.
 
err_t expand3_write_register (expand3_t *ctx, uint16_t reg, uint8_t data_in)
 Expand 3 write register function.
 
err_t expand3_read_state (expand3_t *ctx, uint8_t *state)
 Expand 3 read state function.
 
err_t expand3_write_state (expand3_t *ctx, uint8_t state)
 Expand 3 write state function.
 
err_t expand3_reset_activity (expand3_t *ctx)
 Expand 3 reset activity function.
 
err_t expand3_write_mask (expand3_t *ctx, uint8_t mask)
 Expand 3 write mask function.
 
err_t expand3_write_polarity (expand3_t *ctx, uint8_t polarity)
 Expand 3 write polarity function.
 
err_t expand3_write_control (expand3_t *ctx, uint8_t control)
 Expand 3 write control function.
 
err_t expand3_read_control (expand3_t *ctx, uint8_t *control)
 Expand 3 read control function.
 
err_t expand3_read_current_state (expand3_t *ctx, uint8_t *curr_state)
 Expand 3 read current state function.
 
err_t expand3_read_last_state (expand3_t *ctx, uint8_t *last_state)
 Expand 3 read last state function.
 
err_t expand3_read_activity (expand3_t *ctx, uint8_t *activity)
 Expand 3 read activity function.
 
void expand3_set_rst_pin (expand3_t *ctx, uint8_t state)
 Expand 3 set rst pin function.
 
void expand3_reset_device (expand3_t *ctx)
 Expand 3 reset device function.
 

Detailed Description

API for configuring and manipulating Expand 3 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

◆ expand3_cfg_setup()

void expand3_cfg_setup ( expand3_cfg_t * cfg)

Expand 3 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ expand3_check_communication()

err_t expand3_check_communication ( expand3_t * ctx)

Expand 3 check communication function.

This function checks the communication by reading the ROM address as well as verifying family code and CRC 8.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_default_cfg()

err_t expand3_default_cfg ( expand3_t * ctx)

Expand 3 default configuration function.

This function executes a default configuration of Expand 3 click board.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ expand3_gpio_selection()

void expand3_gpio_selection ( expand3_cfg_t * cfg,
expand3_gpio_sel_t gpio_sel )

Expand 3 driver interface setup function.

This function sets a communication GPIO pin which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See expand3_cfg_t object definition for detailed explanation.
[in]gpio_sel: GPIO pin selection. See expand3_gpio_sel_t object definition for detailed explanation.
Returns
Nothing.
Note
This gpio selection should be called before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ expand3_init()

err_t expand3_init ( expand3_t * ctx,
expand3_cfg_t * cfg )

Expand 3 initialization function.

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

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

◆ expand3_read_activity()

err_t expand3_read_activity ( expand3_t * ctx,
uint8_t * activity )

Expand 3 read activity function.

This function reads the current state of the PIO activity latches.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
[out]activity: PIO activity latches state.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_read_control()

err_t expand3_read_control ( expand3_t * ctx,
uint8_t * control )

Expand 3 read control function.

This function reads a control or status register settings.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
[out]control: Control or status byte read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_read_current_state()

err_t expand3_read_current_state ( expand3_t * ctx,
uint8_t * curr_state )

Expand 3 read current state function.

This function reads the current logic state of the PIO pins.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
[out]curr_state: PIO state read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_read_last_state()

err_t expand3_read_last_state ( expand3_t * ctx,
uint8_t * last_state )

Expand 3 read last state function.

This function reads the latest data written to the PIO using the expand3_write_state function.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
[out]last_state: Latest data written to the PIO.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_read_register()

err_t expand3_read_register ( expand3_t * ctx,
uint16_t reg,
uint8_t * data_out )

Expand 3 read register function.

This function reads data from the selected register by using One Wire communication protocol.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_read_state()

err_t expand3_read_state ( expand3_t * ctx,
uint8_t * state )

Expand 3 read state function.

This function reads the status of all eight PIO channels.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
[out]state: PIO state read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_reset_activity()

err_t expand3_reset_activity ( expand3_t * ctx)

Expand 3 reset activity function.

This function resets an activity latch that is set whenever there is a state transition at a PIO pin.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_reset_device()

void expand3_reset_device ( expand3_t * ctx)

Expand 3 reset device function.

This function resets the device by toggling the RST pin state.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ expand3_select_device()

err_t expand3_select_device ( expand3_t * ctx)

Expand 3 select device function.

This function selects the device by performing a skip or match ROM commands depending on the address value set in the ctx->address.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_set_rst_pin()

void expand3_set_rst_pin ( expand3_t * ctx,
uint8_t state )

Expand 3 set rst pin function.

This function sets the reset pin logic state.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ expand3_write_control()

err_t expand3_write_control ( expand3_t * ctx,
uint8_t control )

Expand 3 write control function.

This function writes a control register which determines the function of the RSTZ pin and further configures the device for conditional search.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
[in]control: Control byte to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_write_mask()

err_t expand3_write_mask ( expand3_t * ctx,
uint8_t mask )

Expand 3 write mask function.

This function writes a conditional search channel selection mask which controls wheather a PIO channel qualifies for participation in the conditional search command.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
[in]mask: Mask byte to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_write_polarity()

err_t expand3_write_polarity ( expand3_t * ctx,
uint8_t polarity )

Expand 3 write polarity function.

This function writes a conditional search channel polarity selection which specifies the polarity of each selected PIO channel for the device to respond to the conditional search command.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
[in]polarity: Polarity byte to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_write_register()

err_t expand3_write_register ( expand3_t * ctx,
uint16_t reg,
uint8_t data_in )

Expand 3 write register function.

This function writes data to the selected register by using One Wire communication protocol.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ expand3_write_state()

err_t expand3_write_state ( expand3_t * ctx,
uint8_t state )

Expand 3 write state function.

This function writes data to the PIO output-latch state register which controls the open-drain output transistors of the PIO channels.

Parameters
[in]ctx: Click context object. See expand3_t object definition for detailed explanation.
[in]state: PIO state to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.