rotaryswitch  2.1.0.0
Modules | Functions
Rotary Switch Click Driver

API for configuring and manipulating Rotary Switch Click driver. More...

Modules

 Rotary Switch Registers List
 List of registers of Rotary Switch Click driver.
 
 Rotary Switch Registers Settings
 Settings for registers of Rotary Switch Click driver.
 
 Rotary Switch MikroBUS Map
 MikroBUS pin mapping of Rotary Switch Click driver.
 

Functions

void rotaryswitch_cfg_setup (rotaryswitch_cfg_t *cfg)
 Rotary Switch configuration object setup function. More...
 
err_t rotaryswitch_init (rotaryswitch_t *ctx, rotaryswitch_cfg_t *cfg)
 Rotary Switch initialization function. More...
 
err_t rotaryswitch_default_cfg (rotaryswitch_t *ctx)
 Rotary Switch default configuration function. More...
 
err_t rotaryswitch_write_reg (rotaryswitch_t *ctx, uint8_t reg, uint8_t data_in)
 Rotary Switch write reg function. More...
 
err_t rotaryswitch_read_reg (rotaryswitch_t *ctx, uint8_t reg, uint8_t *data_out)
 Rotary Switch read reg function. More...
 
err_t rotaryswitch_get_position (rotaryswitch_t *ctx, uint8_t *position)
 Rotary Switch get position function. More...
 

Detailed Description

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

◆ rotaryswitch_cfg_setup()

void rotaryswitch_cfg_setup ( rotaryswitch_cfg_t cfg)

Rotary Switch configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ rotaryswitch_default_cfg()

err_t rotaryswitch_default_cfg ( rotaryswitch_t ctx)

Rotary Switch default configuration function.

This function executes a default configuration of Rotary Switch click board.

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

◆ rotaryswitch_get_position()

err_t rotaryswitch_get_position ( rotaryswitch_t ctx,
uint8_t *  position 
)

Rotary Switch get position function.

This function reads the rotary switch position.

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

◆ rotaryswitch_init()

err_t rotaryswitch_init ( rotaryswitch_t ctx,
rotaryswitch_cfg_t cfg 
)

Rotary Switch initialization function.

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

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

◆ rotaryswitch_read_reg()

err_t rotaryswitch_read_reg ( rotaryswitch_t ctx,
uint8_t  reg,
uint8_t *  data_out 
)

Rotary Switch read reg function.

This function reads data from the selected register by using I2C serial interface.

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

◆ rotaryswitch_write_reg()

err_t rotaryswitch_write_reg ( rotaryswitch_t ctx,
uint8_t  reg,
uint8_t  data_in 
)

Rotary Switch write reg function.

This function writes a desired data to the selected register by using I2C serial interface.

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