Skip to content

BSP Buzzer Module

Board-level view of the buzzer: how a BSP wires the shared LEDC driver. The application side (sound events, priorities, customization) is the sound module, documented in buzzer.md and sound_system.md.

The former application layer (Buzzer class / esp3d_buzzer, esp3d_notes.h, blocking buzzer_bip(), malloc + task based buzzer_play(), buzzer_tone.h) was removed in a14.


buzzer_configure(&buzzer_cfg)

tone start / stop

Sound module (main/modules/buzzer/)

esp3d_sound · esp_timer sequencer

tone backend

LEDC driver (hardware/common/drivers/buzzer/)

buzzer_configure() · buzzer_tone_start() · buzzer_tone_stop()

BSP (boards/pibot_pendant_v1_0/components/bsp/)

board_config.h constants · buzzer_def.h · board_init()


ConstantValueMeaning
BUZZER_PINGPIO_NUM_26Buzzer GPIO
BUZZER_ACTIVE_HIGH_FLAG1GPIO level for buzzer on
BUZZER_PWM_FREQ_HZ1000Default PWM frequency (each note sets its own)
BUZZER_PWM_RESOLUTION_BITS10Duty resolution
BUZZER_PWM_TIMER_IDX / BUZZER_PWM_CHANNEL_IDX1 / 1LEDC timer / channel
BUZZER_PWM_DUTY_PERCENT15Volume (1–50 %, 50 = loudest); lowered because SC8002B current peaks on fast repeated key beeps are suspected of causing BROWNOUT resets (2026-11-01, not confirmed on hardware)
buzzer_config_t buzzer_cfg = {
.output_invert = !BUZZER_ACTIVE_HIGH_FLAG, // Invert if not active-high
.gpio_num = BUZZER_PIN,
.timer_idx = BUZZER_PWM_TIMER_IDX,
.channel_idx = BUZZER_PWM_CHANNEL_IDX,
.freq_hz = BUZZER_PWM_FREQ_HZ,
.resolution_bits = BUZZER_PWM_RESOLUTION_BITS,
.duty_percent = BUZZER_PWM_DUTY_PERCENT,
};
#if (ESP3D_BUZZER_FEATURE)
ret = buzzer_configure(&buzzer_cfg);
if (ret != ESP_OK)
{
esp3d_log_e("Buzzer initialization failed");
return ret;
}
#endif // ESP3D_BUZZER_FEATURE

Driver API (hardware/common/drivers/buzzer/buzzer.h)

Section titled “Driver API (hardware/common/drivers/buzzer/buzzer.h)”
FunctionDescription
buzzer_configure(const buzzer_config_t *config)LEDC timer + channel setup for the buzzer GPIO
buzzer_tone_start(uint16_t freq_hz)Continuous tone, non-blocking, safe from an esp_timer callback; 0 = silence
buzzer_tone_stop(void)Silence, non-blocking

Only the sound module’s tone backend calls buzzer_tone_start() / buzzer_tone_stop(), from its esp_timer callback, so there is no concurrent LEDC access.

Boards without a buzzer leave BUZZER_SERVICE OFF (today only pibot_pendant_v1_0 enables it). The Factory apps and the PiBot custom bootloader have their own standalone buzzer code, see buzzer.md “Factory App & Bootloader Buzzer”.