piezodriver 2.1.0.0
Piezo Driver Click Driver

API for configuring and manipulating Piezo Driver Click driver. More...

Topics

 Piezo Driver PWM Settings
 Settings for configuration of Piezo Driver Click driver.
 
 Piezo Driver MikroBUS Map
 MikroBUS pin mapping of Piezo Driver Click driver.
 

Functions

void piezodriver_cfg_setup (piezodriver_cfg_t *cfg)
 Piezo Driver configuration object setup function.
 
err_t piezodriver_init (piezodriver_t *ctx, piezodriver_cfg_t *cfg)
 Piezo Driver initialization function.
 
err_t piezodriver_default_cfg (piezodriver_t *ctx)
 Piezo Driver default configuration function.
 
err_t piezodriver_set_duty_cycle (piezodriver_t *ctx, float duty_cycle)
 Piezo Driver sets PWM duty cycle.
 
err_t piezodriver_pwm_stop (piezodriver_t *ctx)
 Piezo Driver stop PWM module.
 
err_t piezodriver_pwm_start (piezodriver_t *ctx)
 Piezo Driver start PWM module.
 
void piezodriver_play_sound (piezodriver_t *ctx, uint16_t freq, uint8_t level, uint16_t duration)
 Piezo Driver play sound function.
 

Detailed Description

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

◆ piezodriver_cfg_setup()

void piezodriver_cfg_setup ( piezodriver_cfg_t * cfg)

Piezo Driver configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ piezodriver_default_cfg()

err_t piezodriver_default_cfg ( piezodriver_t * ctx)

Piezo Driver default configuration function.

This function executes a default configuration of Piezo Driver click board.

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

◆ piezodriver_init()

err_t piezodriver_init ( piezodriver_t * ctx,
piezodriver_cfg_t * cfg )

Piezo Driver initialization function.

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

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

◆ piezodriver_play_sound()

void piezodriver_play_sound ( piezodriver_t * ctx,
uint16_t freq,
uint8_t level,
uint16_t duration )

Piezo Driver play sound function.

This function is used to play sound on the buzzer.

Parameters
[in]ctx: Click object. See piezodriver_t object definition for detailed explanation.
[in]freq: Buzz sound frequency.
[in]level: Buzz sound level. ( min = 0, max = 100 )
[in]duration: Buzz sound duration in miliseconds.
Returns
Nothing.
Note
None.

◆ piezodriver_pwm_start()

err_t piezodriver_pwm_start ( piezodriver_t * ctx)

Piezo Driver start PWM module.

This function starts the PWM module output.

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

◆ piezodriver_pwm_stop()

err_t piezodriver_pwm_stop ( piezodriver_t * ctx)

Piezo Driver stop PWM module.

This function stops the PWM module output.

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

◆ piezodriver_set_duty_cycle()

err_t piezodriver_set_duty_cycle ( piezodriver_t * ctx,
float duty_cycle )

Piezo Driver sets PWM duty cycle.

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

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