projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/scheme: apply also needs to not free value list on lambdas
[fw/altos]
/
src
/
stmf0
/
ao_beep_stm.c
diff --git
a/src/stmf0/ao_beep_stm.c
b/src/stmf0/ao_beep_stm.c
index 84ccd93e9cca27578be67ad13ba4d0b4ef57e345..15137230a9b84d2bbba7cec8d24817b308beaafc 100644
(file)
--- a/
src/stmf0/ao_beep_stm.c
+++ b/
src/stmf0/ao_beep_stm.c
@@
-25,6
+25,10
@@
#define BEEPER_TIMER 1
#endif
#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
#define timer stm_tim1
#define STM_RCC_TIMER STM_RCC_APB2ENR_TIM1EN
@@
-55,6
+59,9
@@
disable(void)
timer.bdtr = 0;
#endif
stm_rcc_enr &= ~(1 << STM_RCC_TIMER);
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
}
void
@@
-361,6
+368,9
@@
ao_beep(uint8_t beep)
/* Update the values */
timer.egr = (1 << STM_TIM23_EGR_UG);
/* 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, BEEPER_AFR);
#endif
}
}
#endif
}
}
@@
-376,8
+386,7
@@
ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant
void
ao_beep_init(void)
{
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);
/* Leave the timer off until requested */
stm_rcc_enr &= ~(1 << STM_RCC_TIMER);