timer.bdtr = 0;
#endif
stm_rcc_enr &= ~(1 << STM_RCC_TIMER);
+
+ /* Disconnect the timer from the pin */
+ stm_afr_set(BEEPER_PORT, BEEPER_PIN, STM_AFR_NONE);
}
void
/* Update the values */
timer.egr = (1 << STM_TIM23_EGR_UG);
+
+ /* Hook the timer up to the beeper pin */
+ stm_afr_set(BEEPER_PORT, BEEPER_PIN, STM_AFR_AF2);
#endif
}
}
void
ao_beep_init(void)
{
- ao_enable_port(BEEPER_PORT);
- stm_afr_set(BEEPER_PORT, BEEPER_PIN, STM_AFR_AF2);
+ ao_enable_output(BEEPER_PORT, BEEPER_PIN, BEEPER, 0);
/* Leave the timer off until requested */
stm_rcc_enr &= ~(1 << STM_RCC_TIMER);