1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 23:11:19 +01:00

cpu/stm32l1: Update to match timer_init API change

This commit is contained in:
Joakim Nohlgård 2015-10-04 00:23:20 +02:00
parent 3e0d6f167f
commit 68ddb1a7a9

View File

@ -43,7 +43,7 @@ static inline TIM_TypeDef *_tim(tim_t dev)
return timer_config[dev].dev;
}
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 *tim;
@ -64,7 +64,7 @@ int timer_init(tim_t dev, unsigned int ticks_per_us, void (*callback)(int))
tim->SR = 0;
/* configure reload and pre-scaler values */
tim->ARR = 0xffffffff;
tim->PSC = (((CLOCK_CORECLOCK / 1000000) * ticks_per_us) - 1);
tim->PSC = (CLOCK_CORECLOCK / freq) - 1;
/* trigger update event to make pre-scaler value effective */
tim->EGR = TIM_EGR_UG;
/* enable interrupts and start the timer */