buzzer: ensure PWM is enabled on the output pin

This commit is contained in:
Thomas Kolb 2024-05-18 00:15:22 +02:00
parent 8b0b03e0ee
commit d95248866b

View file

@ -31,6 +31,7 @@ void buzzer_on(uint16_t freq_hz)
uint32_t divider_x100 = FREQ_BASE / freq_hz; // = 100 * 125e6 / 512 / freq_hz
pwm_set_clkdiv_int_frac(m_slice_num, divider_x100 / 100, divider_x100 % 100);
gpio_set_function(BUZZER_PIN, GPIO_FUNC_PWM);
pwm_set_enabled(m_slice_num, true);
}