diff --git a/boards/fox/include/board.h b/boards/fox/include/board.h index 6717f2c77c..6b2ec7e17f 100644 --- a/boards/fox/include/board.h +++ b/boards/fox/include/board.h @@ -33,6 +33,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/fox/include/periph_conf.h b/boards/fox/include/periph_conf.h index 41997a3b3b..9430cb95ac 100644 --- a/boards/fox/include/periph_conf.h +++ b/boards/fox/include/periph_conf.h @@ -19,6 +19,8 @@ #ifndef PERIPH_CONF_H_ #define PERIPH_CONF_H_ +#include "periph_cpu.h" + #ifdef __cplusplus extern "C" { #endif @@ -45,37 +47,16 @@ extern "C" { * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (2U) -#define TIMER_0_EN 1 -#define TIMER_1_EN 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 } +}; -/* 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 (0xffff) -#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 +#define TIMER_0_ISR isr_tim2 +#define TIMER_1_ISR isr_tim3 -/* 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 (0xffff) -#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 +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /**