rotaryw2 2.1.0.0
Rotary W 2 Click Driver

API for configuring and manipulating Rotary W 2 Click driver. More...

Topics

 Rotary W 2 Registers Settings
 Settings for registers of Rotary W 2 Click driver.
 
 Rotary W 2 MikroBUS Map
 MikroBUS pin mapping of Rotary W 2 Click driver.
 

Functions

void rotaryw2_cfg_setup (rotaryw2_cfg_t *cfg)
 Rotary W 2 configuration object setup function.
 
err_t rotaryw2_init (rotaryw2_t *ctx, rotaryw2_cfg_t *cfg)
 Rotary W 2 initialization function.
 
err_t rotaryw2_default_cfg (rotaryw2_t *ctx)
 Rotary W 2 default configuration function.
 
err_t rotaryw2_set_led_data (rotaryw2_t *ctx, uint16_t data_in)
 Rotary W 2 set LED data function.
 
err_t rotaryw2_get_led_data (rotaryw2_t *ctx, uint16_t *data_out)
 Rotary W 2 get LED data function.
 
err_t rotaryw2_set_led_pos (rotaryw2_t *ctx, uint8_t led_pos)
 Rotary W 2 set LED position function.
 
uint8_t rotaryw2_get_state_switch (rotaryw2_t *ctx)
 Rotary W 2 get switch state function.
 
uint8_t rotaryw2_get_state_ena (rotaryw2_t *ctx)
 Rotary W 2 get ena state function.
 
uint8_t rotaryw2_get_state_enb (rotaryw2_t *ctx)
 Rotary W 2 get enb state function.
 

Detailed Description

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

◆ rotaryw2_cfg_setup()

void rotaryw2_cfg_setup ( rotaryw2_cfg_t * cfg)

Rotary W 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ rotaryw2_default_cfg()

err_t rotaryw2_default_cfg ( rotaryw2_t * ctx)

Rotary W 2 default configuration function.

This function executes a default configuration of Rotary W 2 click board.

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

◆ rotaryw2_get_led_data()

err_t rotaryw2_get_led_data ( rotaryw2_t * ctx,
uint16_t * data_out )

Rotary W 2 get LED data function.

This function, using SPI serial interface, reads a 16-bit data from the TLC5925, Low-Power 16-Channel Constant-Current LED Sink Driver on the Rotary W 2 Click board™.

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

◆ rotaryw2_get_state_ena()

uint8_t rotaryw2_get_state_ena ( rotaryw2_t * ctx)

Rotary W 2 get ena state function.

This function return rotary encoder A signal, states of the ENA(PWM) pin of the EC12D1564402 on the Rotary W 2 Click board™.

Parameters
[in]ctx: Click context object. See rotaryw2_t object definition for detailed explanation.
Returns
  • 0 - Low state,
  • 1 - High state.
Note
None.

◆ rotaryw2_get_state_enb()

uint8_t rotaryw2_get_state_enb ( rotaryw2_t * ctx)

Rotary W 2 get enb state function.

This function return rotary encoder A signal, states of the ENB(PWM) pin of the EC12D1564402 on the Rotary W 2 Click board™.

Parameters
[in]ctx: Click context object. See rotaryw2_t object definition for detailed explanation.
Returns
  • 0 - Low state,
  • 1 - High state.
Note
None.

◆ rotaryw2_get_state_switch()

uint8_t rotaryw2_get_state_switch ( rotaryw2_t * ctx)

Rotary W 2 get switch state function.

This function return rotary encoder switch signal, states of the SW(INT) pin of the EC12D1564402 on the Rotary W 2 Click board™.

Parameters
[in]ctx: Click context object. See rotaryw2_t object definition for detailed explanation.
Returns
  • 0 - Released state,
  • 1 - Pressed state.
Note
None.

◆ rotaryw2_init()

err_t rotaryw2_init ( rotaryw2_t * ctx,
rotaryw2_cfg_t * cfg )

Rotary W 2 initialization function.

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

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

◆ rotaryw2_set_led_data()

err_t rotaryw2_set_led_data ( rotaryw2_t * ctx,
uint16_t data_in )

Rotary W 2 set LED data function.

This function, using SPI serial interface, writes a desired 16-bit data of the TLC5925, Low-Power 16-Channel Constant-Current LED Sink Driver on the Rotary W 2 Click board™.

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

◆ rotaryw2_set_led_pos()

err_t rotaryw2_set_led_pos ( rotaryw2_t * ctx,
uint8_t led_pos )

Rotary W 2 set LED position function.

This function turns on the LED for the selected LED position of the TLC5925, Low-Power 16-Channel Constant-Current LED Sink Driver on the Rotary W 2 Click board™.

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