buzzer
2.1.0.0
|
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... | |
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.
void buzzer_cfg_setup | ( | buzzer_cfg_t * | cfg | ) |
Buzzer configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See buzzer_cfg_t object definition for detailed explanation. |
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.
[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. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[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. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t buzzer_pwm_start | ( | buzzer_t * | ctx | ) |
Buzzer start PWM module.
This function starts the PWM module output.
[in] | ctx | : Click context object. See buzzer_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t buzzer_pwm_stop | ( | buzzer_t * | ctx | ) |
Buzzer stop PWM module.
This function stops the PWM module output.
[in] | ctx | : Click context object. See buzzer_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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 ] ).
[in] | ctx | : Click context object. See buzzer_t object definition for detailed explanation. |
[in] | duty_cycle | : PWM duty cycle. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.