button3  2.1.0.0
Modules | Functions
Button 3 Click Driver

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

Modules

 Button 3 Registers List
 List of registers of Button 3 Click driver.
 
 Button 3 Registers Settings
 Settings for registers of Button 3 Click driver.
 
 Button 3 MikroBUS Map
 MikroBUS pin mapping of Button 3 Click driver.
 

Functions

void button3_cfg_setup (button3_cfg_t *cfg)
 Button 3 configuration object setup function. More...
 
err_t button3_init (button3_t *ctx, button3_cfg_t *cfg)
 Button 3 initialization function. More...
 
err_t button3_default_cfg (button3_t *ctx)
 Button 3 default configuration function. More...
 
err_t button3_write_reg (button3_t *ctx, uint8_t reg, uint8_t data_in)
 Button 3 write reg function. More...
 
err_t button3_read_reg (button3_t *ctx, uint8_t reg, uint8_t *data_out)
 Button 3 read reg function. More...
 
void button3_reset_device (button3_t *ctx)
 Button 3 reset device function. More...
 
void button3_set_rst_pin (button3_t *ctx, uint8_t state)
 Button 3 set RST pin function. More...
 
uint8_t button3_get_int_pin (button3_t *ctx)
 Button 3 get INT pin function. More...
 
err_t button3_get_red_button (button3_t *ctx, uint8_t *state)
 Button 3 get red button function. More...
 
err_t button3_get_green_button (button3_t *ctx, uint8_t *state)
 Button 3 get green button function. More...
 
err_t button3_get_blue_button (button3_t *ctx, uint8_t *state)
 Button 3 get blue button function. More...
 
err_t button3_get_red_led (button3_t *ctx, uint8_t *state)
 Button 3 get red led function. More...
 
err_t button3_get_green_led (button3_t *ctx, uint8_t *state)
 Button 3 get green led function. More...
 
err_t button3_get_blue_led (button3_t *ctx, uint8_t *state)
 Button 3 get blue led function. More...
 
err_t button3_enable_red_led (button3_t *ctx)
 Button 3 enable red led function. More...
 
err_t button3_enable_green_led (button3_t *ctx)
 Button 3 enable green led function. More...
 
err_t button3_enable_blue_led (button3_t *ctx)
 Button 3 enable blue led function. More...
 
err_t button3_disable_red_led (button3_t *ctx)
 Button 3 disable red led function. More...
 
err_t button3_disable_green_led (button3_t *ctx)
 Button 3 disable green led function. More...
 
err_t button3_disable_blue_led (button3_t *ctx)
 Button 3 disable blue led function. More...
 
err_t button3_toggle_red_led (button3_t *ctx)
 Button 3 toggle red led function. More...
 
err_t button3_toggle_green_led (button3_t *ctx)
 Button 3 toggle green led function. More...
 
err_t button3_toggle_blue_led (button3_t *ctx)
 Button 3 toggle blue led function. More...
 

Detailed Description

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

◆ button3_cfg_setup()

void button3_cfg_setup ( button3_cfg_t cfg)

Button 3 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ button3_default_cfg()

err_t button3_default_cfg ( button3_t ctx)

Button 3 default configuration function.

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

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

◆ button3_disable_blue_led()

err_t button3_disable_blue_led ( button3_t ctx)

Button 3 disable blue led function.

This function disables the blue button LED by setting the BK pin to the high logic state.

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

◆ button3_disable_green_led()

err_t button3_disable_green_led ( button3_t ctx)

Button 3 disable green led function.

This function disables the green button LED by setting the GK pin to the high logic state.

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

◆ button3_disable_red_led()

err_t button3_disable_red_led ( button3_t ctx)

Button 3 disable red led function.

This function disables the red button LED by setting the RK pin to the high logic state.

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

◆ button3_enable_blue_led()

err_t button3_enable_blue_led ( button3_t ctx)

Button 3 enable blue led function.

This function enables the blue button LED by setting the BK pin to the low logic state.

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

◆ button3_enable_green_led()

err_t button3_enable_green_led ( button3_t ctx)

Button 3 enable green led function.

This function enables the green button LED by setting the GK pin to the low logic state.

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

◆ button3_enable_red_led()

err_t button3_enable_red_led ( button3_t ctx)

Button 3 enable red led function.

This function enables the red button LED by setting the RK pin to the low logic state.

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

◆ button3_get_blue_button()

err_t button3_get_blue_button ( button3_t ctx,
uint8_t *  state 
)

Button 3 get blue button function.

This function reads the blue button (B1 pin) logic state.

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

◆ button3_get_blue_led()

err_t button3_get_blue_led ( button3_t ctx,
uint8_t *  state 
)

Button 3 get blue led function.

This function reads the blue LED (BK pin) logic state.

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

◆ button3_get_green_button()

err_t button3_get_green_button ( button3_t ctx,
uint8_t *  state 
)

Button 3 get green button function.

This function reads the green button (G1 pin) logic state.

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

◆ button3_get_green_led()

err_t button3_get_green_led ( button3_t ctx,
uint8_t *  state 
)

Button 3 get green led function.

This function reads the green LED (GK pin) logic state.

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

◆ button3_get_int_pin()

uint8_t button3_get_int_pin ( button3_t ctx)

Button 3 get INT pin function.

This function returns the INT pin logic state.

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

◆ button3_get_red_button()

err_t button3_get_red_button ( button3_t ctx,
uint8_t *  state 
)

Button 3 get red button function.

This function reads the red button (R1 pin) logic state.

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

◆ button3_get_red_led()

err_t button3_get_red_led ( button3_t ctx,
uint8_t *  state 
)

Button 3 get red led function.

This function reads the red LED (RK pin) logic state.

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

◆ button3_init()

err_t button3_init ( button3_t ctx,
button3_cfg_t cfg 
)

Button 3 initialization function.

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

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

◆ button3_read_reg()

err_t button3_read_reg ( button3_t ctx,
uint8_t  reg,
uint8_t *  data_out 
)

Button 3 read reg function.

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

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

◆ button3_reset_device()

void button3_reset_device ( button3_t ctx)

Button 3 reset device function.

This function resets the device by toggling the RST pin.

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

◆ button3_set_rst_pin()

void button3_set_rst_pin ( button3_t ctx,
uint8_t  state 
)

Button 3 set RST pin function.

This function sets the RST pin logic state.

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

◆ button3_toggle_blue_led()

err_t button3_toggle_blue_led ( button3_t ctx)

Button 3 toggle blue led function.

This function toggles the blue button LED by toggling the BK pin logic state.

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

◆ button3_toggle_green_led()

err_t button3_toggle_green_led ( button3_t ctx)

Button 3 toggle green led function.

This function toggles the green button LED by toggling the GK pin logic state.

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

◆ button3_toggle_red_led()

err_t button3_toggle_red_led ( button3_t ctx)

Button 3 toggle red led function.

This function toggles the red button LED by toggling the RK pin logic state.

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

◆ button3_write_reg()

err_t button3_write_reg ( button3_t ctx,
uint8_t  reg,
uint8_t  data_in 
)

Button 3 write reg function.

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

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