X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fstmf0%2Fao_beep_stm.c;h=31af7f4a00ab74d19fc2fa2a54808ba286630b87;hp=610f4a31ff72968b407f3c5cc0af1e3bf063f5de;hb=cdaa0d7b272505c49017f409b7c0b8e3240608f0;hpb=4682323a4bf147b9a908f5f9104bf01ab2cf0533 diff --git a/src/stmf0/ao_beep_stm.c b/src/stmf0/ao_beep_stm.c index 610f4a31..31af7f4a 100644 --- a/src/stmf0/ao_beep_stm.c +++ b/src/stmf0/ao_beep_stm.c @@ -25,6 +25,10 @@ #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 @@ -366,13 +370,13 @@ ao_beep(uint8_t beep) 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, uint16_t ticks) { ao_beep(beep); ao_delay(ticks); @@ -382,7 +386,7 @@ ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant 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);