buzzer: ensure PWM is enabled on the output pin
This commit is contained in:
parent
8b0b03e0ee
commit
d95248866b
|
@ -31,6 +31,7 @@ void buzzer_on(uint16_t freq_hz)
|
||||||
uint32_t divider_x100 = FREQ_BASE / freq_hz; // = 100 * 125e6 / 512 / 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);
|
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);
|
pwm_set_enabled(m_slice_num, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue