c1wireswitch 2.1.0.0
1-Wire Switch Click Driver

API for configuring and manipulating 1-Wire Switch Click driver. More...

Topics

 1-Wire Switch Commands List
 List of commands of 1-Wire Switch Click driver.
 
 1-Wire Switch Settings
 Settings of 1-Wire Switch Click driver.
 
 1-Wire Switch MikroBUS Map
 MikroBUS pin mapping of 1-Wire Switch Click driver.
 

Functions

void c1wireswitch_cfg_setup (c1wireswitch_cfg_t *cfg)
 1-Wire Switch configuration object setup function.
 
void c1wireswitch_gpio_selection (c1wireswitch_cfg_t *cfg, c1wireswitch_gpio_sel_t gpio_sel)
 1-Wire Switch driver interface setup function.
 
err_t c1wireswitch_init (c1wireswitch_t *ctx, c1wireswitch_cfg_t *cfg)
 1-Wire Switch initialization function.
 
err_t c1wireswitch_default_cfg (c1wireswitch_t *ctx)
 1-Wire Switch default configuration function.
 
err_t c1wireswitch_check_communication (c1wireswitch_t *ctx)
 1-Wire Switch check communication function.
 
err_t c1wireswitch_select_device (c1wireswitch_t *ctx)
 1-Wire Switch select device function.
 
err_t c1wireswitch_read_scratchpad (c1wireswitch_t *ctx, uint8_t *scratchpad, uint8_t scratchpad_len)
 1-Wire Switch read scratchpad function.
 
err_t c1wireswitch_write_scratchpad (c1wireswitch_t *ctx, uint8_t *scratchpad, uint8_t scratchpad_len)
 1-Wire Switch write scratchpad function.
 
err_t c1wireswitch_write_pio (c1wireswitch_t *ctx, uint8_t state)
 1-Wire Switch write programmable I/O state function.
 
err_t c1wireswitch_read_pio (c1wireswitch_t *ctx, uint8_t *state)
 1-Wire Switch read programmable I/O state function.
 
err_t c1wireswitch_set_pio_state (c1wireswitch_t *ctx, uint8_t pio_a, uint8_t pio_b)
 1-Wire Switch write specific programmable I/O state function.
 
err_t c1wireswitch_get_pio_state (c1wireswitch_t *ctx, uint8_t *pio_a, uint8_t *pio_b)
 1-Wire Switch read specific programmable I/O state function.
 
err_t c1wireswitch_get_pio_latch_state (c1wireswitch_t *ctx, uint8_t *pio_a_latch, uint8_t *pio_b_latch)
 1-Wire Switch read programmable I/O latch state function.
 

Detailed Description

API for configuring and manipulating 1-Wire Switch 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

◆ c1wireswitch_cfg_setup()

void c1wireswitch_cfg_setup ( c1wireswitch_cfg_t * cfg)

1-Wire Switch configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ c1wireswitch_check_communication()

err_t c1wireswitch_check_communication ( c1wireswitch_t * ctx)

1-Wire Switch check communication function.

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

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

◆ c1wireswitch_default_cfg()

err_t c1wireswitch_default_cfg ( c1wireswitch_t * ctx)

1-Wire Switch default configuration function.

This function executes a default configuration of 1-Wire Switch click board.

Parameters
[in]ctx: Click context object. See c1wireswitch_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.

◆ c1wireswitch_get_pio_latch_state()

err_t c1wireswitch_get_pio_latch_state ( c1wireswitch_t * ctx,
uint8_t * pio_a_latch,
uint8_t * pio_b_latch )

1-Wire Switch read programmable I/O latch state function.

This function reads a programmable I/O latch state using One Wire communication protocol.

Parameters
[in]ctx: Click context object. See c1wireswitch_t object definition for detailed explanation.
[out]pio_a_latch: State of the latch A.
[out]pio_b_latch: State of the latch B.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1wireswitch_get_pio_state()

err_t c1wireswitch_get_pio_state ( c1wireswitch_t * ctx,
uint8_t * pio_a,
uint8_t * pio_b )

1-Wire Switch read specific programmable I/O state function.

This function reads a specific programmable I/O state using One Wire communication protocol.

Parameters
[in]ctx: Click context object. See c1wireswitch_t object definition for detailed explanation.
[out]pio_a: State of the I/O A.
[out]pio_b: State of the I/O B.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1wireswitch_gpio_selection()

void c1wireswitch_gpio_selection ( c1wireswitch_cfg_t * cfg,
c1wireswitch_gpio_sel_t gpio_sel )

1-Wire Switch 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 c1wireswitch_cfg_t object definition for detailed explanation.
[in]gpio_sel: GPIO pin selection. See c1wireswitch_gpio_sel_t object definition for detailed explanation.
Returns
Nothing.
Note
This gpio selection should be call 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.

◆ c1wireswitch_init()

err_t c1wireswitch_init ( c1wireswitch_t * ctx,
c1wireswitch_cfg_t * cfg )

1-Wire Switch initialization function.

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

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

◆ c1wireswitch_read_pio()

err_t c1wireswitch_read_pio ( c1wireswitch_t * ctx,
uint8_t * state )

1-Wire Switch read programmable I/O state function.

This function reads a programmable I/O state using One Wire communication protocol.

Parameters
[in]ctx: Click context object. See c1wireswitch_t object definition for detailed explanation.
[out]state: State of the I/O.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1wireswitch_read_scratchpad()

err_t c1wireswitch_read_scratchpad ( c1wireswitch_t * ctx,
uint8_t * scratchpad,
uint8_t scratchpad_len )

1-Wire Switch read scratchpad function.

This function reads a desired number of scratchpad bytes using One Wire communication protocol.

Parameters
[in]ctx: Click context object. See c1wireswitch_t object definition for detailed explanation.
[out]scratchpad: Output read scratchpad.
[in]scratchpad_len: Scratchpad length in bytes.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1wireswitch_select_device()

err_t c1wireswitch_select_device ( c1wireswitch_t * ctx)

1-Wire Switch 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 c1wireswitch_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1wireswitch_set_pio_state()

err_t c1wireswitch_set_pio_state ( c1wireswitch_t * ctx,
uint8_t pio_a,
uint8_t pio_b )

1-Wire Switch write specific programmable I/O state function.

This function writes a specific programmable I/O state using One Wire communication protocol.

Parameters
[in]ctx: Click context object. See c1wireswitch_t object definition for detailed explanation.
[in]pio_a: State of the PIO A to be written.
[in]pio_b: State of the PIO B to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1wireswitch_write_pio()

err_t c1wireswitch_write_pio ( c1wireswitch_t * ctx,
uint8_t state )

1-Wire Switch write programmable I/O state function.

This function writes a programmable I/O state using One Wire communication protocol.

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

◆ c1wireswitch_write_scratchpad()

err_t c1wireswitch_write_scratchpad ( c1wireswitch_t * ctx,
uint8_t * scratchpad,
uint8_t scratchpad_len )

1-Wire Switch write scratchpad function.

This function writes a desired number of scratchpad bytes using One Wire communication protocol.

Parameters
[in]ctx: Click context object. See c1wireswitch_t object definition for detailed explanation.
[in]scratchpad: Scratchpad to be written.
[in]scratchpad_len: Scratchpad length in bytes.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.