#define BEEPER_TIMER 1
#endif
+#ifndef BEEPER_AFR
+#define BEEPER_AFR STM_AFR_AF2
+#endif
+
#if BEEPER_TIMER == 1
#define timer stm_tim1
#define STM_RCC_TIMER STM_RCC_APB2ENR_TIM1EN
#if BEEPER_TIMER == 1
timer.bdtr = 0;
#endif
- stm_rcc_enr &= ~(1 << STM_RCC_TIMER);
+ stm_rcc_enr &= ~(1UL << STM_RCC_TIMER);
/* Disconnect the timer from the pin */
stm_afr_set(BEEPER_PORT, BEEPER_PIN, STM_AFR_NONE);
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);
+ stm_afr_set(BEEPER_PORT, BEEPER_PIN, BEEPER_AFR);
#endif
}
}
void
-ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant
+ao_beep_for(uint8_t beep, AO_TICK_TYPE ticks)
{
ao_beep(beep);
ao_delay(ticks);
void
ao_beep_init(void)
{
- ao_enable_output(BEEPER_PORT, BEEPER_PIN, BEEPER, 0);
+ ao_enable_output(BEEPER_PORT, BEEPER_PIN, 0);
/* Leave the timer off until requested */
- stm_rcc_enr &= ~(1 << STM_RCC_TIMER);
+ stm_rcc_enr &= ~(1UL << STM_RCC_TIMER);
}