File syn_buzzer.h¶
FileList > output > syn_buzzer.h
Go to the source code of this file
Non-blocking Piezo Buzzer & Tone Generator module.
#include "../common/syn_defs.h"#include "../port/syn_port_gpio.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_Buzzer Non-blocking piezo buzzer context. |
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_buzzer_beep (SYN_Buzzer * buz, uint32_t freq_hz, uint32_t duration_ms) Play a single tone non-blockingly. |
| SYN_Status | syn_buzzer_init (SYN_Buzzer * buz, SYN_GPIO_Pin pin, bool active_high) Initialize a buzzer instance on a GPIO pin. |
| bool | syn_buzzer_is_playing (const SYN_Buzzer * buz) Check if buzzer is currently playing a tone or melody pattern. |
| SYN_Status | syn_buzzer_play_pattern (SYN_Buzzer * buz, const uint16_t * freqs, const uint16_t * durs, size_t count) Play a sequence of tones (melody/pattern) non-blockingly. |
| void | syn_buzzer_step (SYN_Buzzer * buz, uint32_t dt_ms) Update buzzer state machine. Call periodically in main/scheduler loop. |
| void | syn_buzzer_stop (SYN_Buzzer * buz) Stop audio output immediately. |
Public Functions Documentation¶
function syn_buzzer_beep¶
Play a single tone non-blockingly.
Parameters:
buzBuzzer context.freq_hzFrequency in Hz (0 = silent pause).duration_msDuration in milliseconds.
Returns:
SYN_OK on success.
function syn_buzzer_init¶
Initialize a buzzer instance on a GPIO pin.
Parameters:
buzBuzzer context.pinGPIO pin identifier.active_highTrue if HIGH logic turns on buzzer.
Returns:
SYN_OK on success.
function syn_buzzer_is_playing¶
Check if buzzer is currently playing a tone or melody pattern.
Parameters:
buzBuzzer context.
Returns:
True if active.
function syn_buzzer_play_pattern¶
Play a sequence of tones (melody/pattern) non-blockingly.
SYN_Status syn_buzzer_play_pattern (
SYN_Buzzer * buz,
const uint16_t * freqs,
const uint16_t * durs,
size_t count
)
Parameters:
buzBuzzer context.freqsArray of note frequencies in Hz.dursArray of note durations in ms.countNumber of notes in the pattern.
Returns:
SYN_OK on success.
function syn_buzzer_step¶
Update buzzer state machine. Call periodically in main/scheduler loop.
Parameters:
buzBuzzer context.dt_msMilliseconds elapsed since last call.
function syn_buzzer_stop¶
Stop audio output immediately.
Parameters:
buzBuzzer context.
The documentation for this class was generated from the following file src/syntropic/output/syn_buzzer.h