diff --git a/boards/iotlab-m3/include/board.h b/boards/iotlab-m3/include/board.h index 9b5aaa139..28b295334 100644 --- a/boards/iotlab-m3/include/board.h +++ b/boards/iotlab-m3/include/board.h @@ -42,6 +42,11 @@ extern "C" { #endif /** @} */ +/** + * @name Tell the xtimer that we use a 16-bit peripheral timer + */ +#define XTIMER_MASK (0xffff0000) + /** * @name Define the interface to the AT86RF231 radio * diff --git a/boards/iotlab-m3/include/periph_conf.h b/boards/iotlab-m3/include/periph_conf.h index b1549f5f4..03516983b 100644 --- a/boards/iotlab-m3/include/periph_conf.h +++ b/boards/iotlab-m3/include/periph_conf.h @@ -20,6 +20,8 @@ #ifndef PERIPH_CONF_H_ #define PERIPH_CONF_H_ +#include "periph_cpu.h" + #ifdef __cplusplus extern "C" { #endif @@ -46,37 +48,16 @@ extern "C" { * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (2U) -#define TIMER_0_EN 1 -#define TIMER_1_EN 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV_0 TIM2 -#define TIMER_0_DEV_1 TIM3 -#define TIMER_0_CHANNELS 4 -#define TIMER_0_FREQ (CLOCK_CORECLOCK) -#define TIMER_0_MAX_VALUE (0xffffffff) -#define TIMER_0_CLKEN() (RCC->APB1ENR |= (RCC_APB1ENR_TIM2EN | RCC_APB1ENR_TIM3EN)) -#define TIMER_0_ISR_0 isr_tim2 -#define TIMER_0_ISR_1 isr_tim3 -#define TIMER_0_IRQ_CHAN_0 TIM2_IRQn -#define TIMER_0_IRQ_CHAN_1 TIM3_IRQn -#define TIMER_0_IRQ_PRIO 1 -#define TIMER_0_TRIG_SEL TIM_SMCR_TS_0 - -/* Timer 1 configuration */ -#define TIMER_1_DEV_0 TIM4 -#define TIMER_1_DEV_1 TIM5 -#define TIMER_1_CHANNELS 4 -#define TIMER_1_FREQ (CLOCK_CORECLOCK) -#define TIMER_1_MAX_VALUE (0xffffffff) -#define TIMER_1_CLKEN() (RCC->APB1ENR |= (RCC_APB1ENR_TIM4EN | RCC_APB1ENR_TIM5EN)) -#define TIMER_1_ISR_0 isr_tim4 -#define TIMER_1_ISR_1 isr_tim5 -#define TIMER_1_IRQ_CHAN_0 TIM4_IRQn -#define TIMER_1_IRQ_CHAN_1 TIM5_IRQn -#define TIMER_1_IRQ_PRIO 1 -#define TIMER_1_TRIG_SEL TIM_SMCR_TS_1 +static const timer_conf_t timer_config[] = { + /* device, APB bus, rcc_bit */ + { TIM2, APB1, RCC_APB1ENR_TIM2EN, TIM2_IRQn }, + { TIM3, APB1, RCC_APB1ENR_TIM3EN, TIM3_IRQn } +}; + +#define TIMER_0_ISR isr_tim2 +#define TIMER_1_ISR isr_tim3 + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /**