Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
buzzer.h File Reference

Main header file for buzzer driver API. More...

#include <errno.h>
#include <stdint.h>
#include <zephyr/device.h>

Go to the source code of this file.

Data Structures

struct  buzzer_driver_api
  Driver Operations Buzzer driver operations More...

Macros

#define BUZZER_FREQ_REST   0U
 Special frequency value representing silence.
#define BUZZER_VOLUME_MAX   100U
 Maximum volume level, range is 0 to BUZZER_VOLUME_MAX.
#define BUZZER_DURATION_FOREVER   UINT32_MAX
 Special duration meaning "play until explicitly stopped".

Typedefs

typedef int(* buzzer_tone_t) (const struct device *dev, uint32_t freq_hz, uint32_t duration_ms)
 Play a single tone for a given duration.
typedef int(* buzzer_set_volume_t) (const struct device *dev, uint8_t percent)
 Set the buzzer volume.
typedef int(* buzzer_beep_t) (const struct device *dev, uint32_t duration_ms)
 Play the buzzer's default tone.
typedef int(* buzzer_stop_t) (const struct device *dev)
 Stop any tone currently being played.

Functions

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.
static int buzzer_set_volume (const struct device *dev, uint8_t percent)
 Set the buzzer volume.
static int buzzer_beep (const struct device *dev, uint32_t duration_ms)
 Play the buzzer's default tone for duration_ms.
static int buzzer_stop (const struct device *dev)
 Stop any tone currently being played.

Detailed Description

Main header file for buzzer driver API.