From 19a95bbfbe32e72dbeb46aeccf94158bb041d5da Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Thu, 6 Nov 2014 15:55:52 +0100 Subject: [PATCH] cpu/stm32f0: fixed low-level timer driver --- cpu/stm32f0/hwtimer_arch.c | 1 - cpu/stm32f0/periph/timer.c | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cpu/stm32f0/hwtimer_arch.c b/cpu/stm32f0/hwtimer_arch.c index f9905e1d04..3bccab5ebb 100644 --- a/cpu/stm32f0/hwtimer_arch.c +++ b/cpu/stm32f0/hwtimer_arch.c @@ -69,5 +69,4 @@ unsigned long hwtimer_arch_now(void) void irq_handler(int channel) { timeout_handler((short)(channel)); - thread_yield(); } diff --git a/cpu/stm32f0/periph/timer.c b/cpu/stm32f0/periph/timer.c index c78aabcac5..074e41fe09 100644 --- a/cpu/stm32f0/periph/timer.c +++ b/cpu/stm32f0/periph/timer.c @@ -22,13 +22,14 @@ #include "cpu.h" #include "board.h" +#include "sched.h" +#include "thread.h" #include "periph_conf.h" #include "periph/timer.h" /* guard file in case no TIMER devices are defined */ #if TIMER_0_EN || TIMER_1_EN - static inline void irq_handler(tim_t timer, TIM_TypeDef *dev); typedef struct { @@ -38,7 +39,7 @@ typedef struct { /** * Timer state memory */ -timer_conf_t config[TIMER_NUMOF]; +static timer_conf_t config[TIMER_NUMOF]; int timer_init(tim_t dev, unsigned int ticks_per_us, void (*callback)(int)) @@ -326,5 +327,8 @@ static inline void irq_handler(tim_t timer, TIM_TypeDef *dev) dev->SR &= ~TIM_SR_CC4IF; config[timer].cb(3); } + if (sched_context_switch_request) { + thread_yield(); + } } #endif /* TIMER_0_EN || TIMER_1_EN */