buzzer  2.1.0.0
Modules | Functions
Buzzer Click Driver

API for configuring and manipulating Buzzer Click driver. More...

Modules

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

Functions

void buzzer_cfg_setup (buzzer_cfg_t *cfg)
 Buzzer configuration object setup function. More...
 
err_t buzzer_init (buzzer_t *ctx, buzzer_cfg_t *cfg)
 Buzzer initialization function. More...
 
err_t buzzer_set_duty_cycle (buzzer_t *ctx, float duty_cycle)
 Buzzer sets PWM duty cycle. More...
 
err_t buzzer_pwm_stop (buzzer_t *ctx)
 Buzzer stop PWM module. More...
 
err_t buzzer_pwm_start (buzzer_t *ctx)
 Buzzer start PWM module. More...
 
err_t buzzer_play_sound (buzzer_t *ctx, uint16_t freq, uint8_t level, uint16_t duration)
 Buzzer play sound function. More...
 

Detailed Description

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

◆ buzzer_cfg_setup()

void buzzer_cfg_setup ( buzzer_cfg_t cfg)

Buzzer configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ buzzer_init()

err_t buzzer_init ( buzzer_t ctx,
buzzer_cfg_t cfg 
)

Buzzer initialization function.

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

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

◆ buzzer_play_sound()

err_t buzzer_play_sound ( buzzer_t ctx,
uint16_t  freq,
uint8_t  level,
uint16_t  duration 
)

Buzzer play sound function.

This function plays sound on the buzzer.

Parameters
[in]ctx: Click context object. See #buzz_t object definition for detailed explanation.
[in]freq: Buzz sound frequency.
[in]level: Buzz sound level. ( min = 1, max = 100 )
[in]duration: Buzz sound duration in miliseconds.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ buzzer_pwm_start()

err_t buzzer_pwm_start ( buzzer_t ctx)

Buzzer start PWM module.

This function starts the PWM module output.

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

◆ buzzer_pwm_stop()

err_t buzzer_pwm_stop ( buzzer_t ctx)

Buzzer stop PWM module.

This function stops the PWM module output.

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

◆ buzzer_set_duty_cycle()

err_t buzzer_set_duty_cycle ( buzzer_t ctx,
float  duty_cycle 
)

Buzzer sets PWM duty cycle.

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

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