|
upm
1.5.0
Sensor/Actuator repository for libmraa (v1.8.0)
|

Go to the source code of this file.
Data Structures | |
| struct | _buzzer_context |
Functions | |
| buzzer_context | buzzer_init (int pin) |
| void | buzzer_close (buzzer_context dev) |
| upm_result_t | buzzer_play_sound (const buzzer_context dev, int note, int delay) |
| upm_result_t | buzzer_stop_sound (const buzzer_context dev) |
| void | buzzer_set_volume (const buzzer_context dev, float vol) |
| float | buzzer_get_volume (const buzzer_context dev) |
Typedefs | |
| typedef struct _buzzer_context * | buzzer_context |
| buzzer_context buzzer_init | ( | int | pin | ) |
Initialize a buzzer context.
| pin | Buzzer pin number (pwm capable) |

| void buzzer_close | ( | buzzer_context | dev | ) |
Buzzer object destructor.
| dev | Device context. |


| upm_result_t buzzer_play_sound | ( | const buzzer_context | dev, |
| int | note, | ||
| int | delay | ||
| ) |
Plays a tone for a certain amount of time or indefinitely. When delay is not used, the sound can be stopped by calling stopSound().
| dev | Device context. |
| note | Note to play (DO, RE, MI, etc.) or frequency |
| delay | Time in microseconds for which to play the sound; if the value is 0, the sound is played indefinitely |


| upm_result_t buzzer_stop_sound | ( | const buzzer_context | dev | ) |
Stops the sound currently playing. Should be called when playSound() does not have a delay value.
| dev | Device context. |

| void buzzer_set_volume | ( | const buzzer_context | dev, |
| float | vol | ||
| ) |
Sets the volume for the buzzer, but may affect the sound timbre. Works best with halved values; e.g., 1.0, 0.5, 0.25, etc.
| dev | Device context. |
| vol | Value to set the volume to, from 0.0 to 1.0 |

| float buzzer_get_volume | ( | const buzzer_context | dev | ) |
Gets the buzzer volume.
| dev | Device context. |

| typedef struct _buzzer_context * buzzer_context |
Device context
1.8.11