buttonpower 2.0.0.0
Button Power Click Driver

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

Topics

 Button Power PWM Settings
 Settings for configuration of Button Power Click driver.
 
 Button Power MikroBUS Map
 MikroBUS pin mapping of Button Power Click driver.
 
 Buttonpower_cfg
 

Functions

void buttonpower_cfg_setup (buttonpower_cfg_t *cfg)
 Button Power configuration object setup function.
 
err_t buttonpower_init (buttonpower_t *ctx, buttonpower_cfg_t *cfg)
 Button Power initialization function.
 
err_t buttonpower_set_duty_cycle (buttonpower_t *ctx, float duty_cycle)
 Button Power sets PWM duty cycle.
 
err_t buttonpower_pwm_stop (buttonpower_t *ctx)
 Button Power stop PWM module.
 
err_t buttonpower_pwm_start (buttonpower_t *ctx)
 Button Power start PWM module.
 
uint8_t buttonpower_get_button_state (buttonpower_t *ctx)
 Button Power get button state function.
 

Detailed Description

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

◆ buttonpower_cfg_setup()

void buttonpower_cfg_setup ( buttonpower_cfg_t * cfg)

Button Power configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ buttonpower_get_button_state()

uint8_t buttonpower_get_button_state ( buttonpower_t * ctx)

Button Power get button state function.

This function reads the digital signal from the INT pin which tells us whether the button has been pressed or not.

Parameters
[out]ctx: Click context object. See buttonpower_t object definition for detailed explanation.
Returns
Function returns pin logical state (1 or 0).

See #err_t definition for detailed explanation.

Note
None.

◆ buttonpower_init()

err_t buttonpower_init ( buttonpower_t * ctx,
buttonpower_cfg_t * cfg )

Button Power initialization function.

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

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

◆ buttonpower_pwm_start()

err_t buttonpower_pwm_start ( buttonpower_t * ctx)

Button Power start PWM module.

This function starts the PWM moudle output.

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

◆ buttonpower_pwm_stop()

err_t buttonpower_pwm_stop ( buttonpower_t * ctx)

Button Power stop PWM module.

This function stops the PWM moudle output.

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

◆ buttonpower_set_duty_cycle()

err_t buttonpower_set_duty_cycle ( buttonpower_t * ctx,
float duty_cycle )

Button Power sets PWM duty cycle.

This function sets the PWM duty cycle in percentages ( Range[ 0..1 ] ).

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