expand3 2.1.0.0
|
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. | |
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.
void expand3_cfg_setup | ( | expand3_cfg_t * | cfg | ) |
Expand 3 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See expand3_cfg_t object definition for detailed explanation. |
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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t expand3_default_cfg | ( | expand3_t * | ctx | ) |
Expand 3 default configuration function.
This function executes a default configuration of Expand 3 click board.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[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. |
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.
[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. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
[out] | activity | : PIO activity latches state. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
[out] | control | : Control or status byte read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
[out] | curr_state | : PIO state read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
[out] | last_state | : Latest data written to the PIO. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
[out] | state | : PIO state read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void expand3_reset_device | ( | expand3_t * | ctx | ) |
Expand 3 reset device function.
This function resets the device by toggling the RST pin state.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
[in] | control | : Control byte to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
[in] | mask | : Mask byte to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
[in] | polarity | : Polarity byte to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See expand3_t object definition for detailed explanation. |
[in] | state | : PIO state to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.