13#ifndef ZEPHYR_INCLUDE_DRIVERS_BUZZER_H_
14#define ZEPHYR_INCLUDE_DRIVERS_BUZZER_H_
43#define BUZZER_FREQ_REST 0U
46#define BUZZER_VOLUME_MAX 100U
55#define BUZZER_DURATION_FOREVER UINT32_MAX
134 return DEVICE_API_GET(buzzer, dev)->tone(dev, freq_hz, duration_ms);
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1425
int(* buzzer_set_volume_t)(const struct device *dev, uint8_t percent)
Set the buzzer volume.
Definition buzzer.h:75
int(* buzzer_tone_t)(const struct device *dev, uint32_t freq_hz, uint32_t duration_ms)
Play a single tone for a given duration.
Definition buzzer.h:67
int(* buzzer_stop_t)(const struct device *dev)
Stop any tone currently being played.
Definition buzzer.h:89
int(* buzzer_beep_t)(const struct device *dev, uint32_t duration_ms)
Play the buzzer's default tone.
Definition buzzer.h:82
static int buzzer_tone(const struct device *dev, uint32_t freq_hz, uint32_t duration_ms)
Play a single tone at freq_hz for duration_ms.
Definition buzzer.h:131
static int buzzer_set_volume(const struct device *dev, uint8_t percent)
Set the buzzer volume.
Definition buzzer.h:156
static int buzzer_stop(const struct device *dev)
Stop any tone currently being played.
Definition buzzer.h:194
static int buzzer_beep(const struct device *dev, uint32_t duration_ms)
Play the buzzer's default tone for duration_ms.
Definition buzzer.h:179
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
<span class="mlabel">Driver Operations</span> Buzzer driver operations
Definition buzzer.h:94
buzzer_stop_t stop
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition buzzer.h:102
buzzer_beep_t beep
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition buzzer.h:100
buzzer_set_volume_t set_volume
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition buzzer.h:98
buzzer_tone_t tone
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition buzzer.h:96
Runtime device structure (in ROM) per driver instance.
Definition device.h:513