mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-22 04:53:50 +01:00
Merge pull request #1956 from haukepetersen/fix_stm32f0_timer
cpu/stm32f0: fixed low-level timer driver
This commit is contained in:
commit
6cc4a7a6eb
@ -69,5 +69,4 @@ unsigned long hwtimer_arch_now(void)
|
|||||||
void irq_handler(int channel)
|
void irq_handler(int channel)
|
||||||
{
|
{
|
||||||
timeout_handler((short)(channel));
|
timeout_handler((short)(channel));
|
||||||
thread_yield();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,13 +22,14 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "sched.h"
|
||||||
|
#include "thread.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "periph/timer.h"
|
#include "periph/timer.h"
|
||||||
|
|
||||||
/* guard file in case no TIMER devices are defined */
|
/* guard file in case no TIMER devices are defined */
|
||||||
#if TIMER_0_EN || TIMER_1_EN
|
#if TIMER_0_EN || TIMER_1_EN
|
||||||
|
|
||||||
|
|
||||||
static inline void irq_handler(tim_t timer, TIM_TypeDef *dev);
|
static inline void irq_handler(tim_t timer, TIM_TypeDef *dev);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -38,7 +39,7 @@ typedef struct {
|
|||||||
/**
|
/**
|
||||||
* Timer state memory
|
* 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))
|
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;
|
dev->SR &= ~TIM_SR_CC4IF;
|
||||||
config[timer].cb(3);
|
config[timer].cb(3);
|
||||||
}
|
}
|
||||||
|
if (sched_context_switch_request) {
|
||||||
|
thread_yield();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* TIMER_0_EN || TIMER_1_EN */
|
#endif /* TIMER_0_EN || TIMER_1_EN */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user