16#include "stm32h7xx_hal.h"
61#define TEMPO_BASE_MS 100
62#define DURATION_QUARTER (TEMPO_BASE_MS)
63#define DURATION_EIGHTH (TEMPO_BASE_MS / 2)
64#define DURATION_HALF (TEMPO_BASE_MS * 2)
buzzer_t buzzer
Global instance of the buzzer object.
void musica_maestro(buzzer_t *bz, const note_t *partition, uint16_t melody_length)
Plays a melody by iterating through an array of notes.
void buzzer_init(buzzer_t *bz, TIM_HandleTypeDef *htim, uint32_t channel)
Initializes the buzzer object and its associated timer hardware.
Represents the buzzer device handle.
uint32_t tim_channel
The specific timer channel connected to the buzzer.
TIM_HandleTypeDef * htim
Pointer to the HAL timer handle controlling the buzzer.
Represents a single musical note with a frequency and duration.
uint16_t duration_ms
The duration to play the note in milliseconds (ms).
uint16_t frequency
The frequency of the note in Hertz (Hz). Use REST for silence.