From e43f503cb6a0798e5d18d5cbdabb7eeeed25e14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= Date: Sun, 4 Oct 2015 00:22:55 +0200 Subject: [PATCH] cpu/stm32f1: Update to match timer_init API change --- cpu/stm32f1/periph/timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu/stm32f1/periph/timer.c b/cpu/stm32f1/periph/timer.c index 777fef6580..45dfbc5a3a 100644 --- a/cpu/stm32f1/periph/timer.c +++ b/cpu/stm32f1/periph/timer.c @@ -45,7 +45,7 @@ typedef struct { */ static timer_conf_t config[TIMER_NUMOF]; -int timer_init(tim_t dev, unsigned int ticks_per_us, void (*callback)(int)) +int timer_init(tim_t dev, unsigned long freq, void (*callback)(int)) { TIM_TypeDef *timer0; TIM_TypeDef *timer1; @@ -95,7 +95,7 @@ int timer_init(tim_t dev, unsigned int ticks_per_us, void (*callback)(int)) timer0->CR2 |= TIM_CR2_MMS_1; /* set auto-reload and prescaler values and load new values */ timer0->ARR = 0xFFFF; - timer0->PSC = TIMER_0_PRESCALER * ticks_per_us; + timer0->PSC = (TIMER_0_FREQ / freq) - 1; // timer->EGR |= TIM_EGR_UG; /* configure slave timer1 */