diff --git a/boards/f4vi1/include/periph_conf.h b/boards/f4vi1/include/periph_conf.h index c4ea0359a78866ae9cf5a88e13cd4ca9a334c5ce..40628145751d4fad33c86ad7bc8639c0981b01d7 100644 --- a/boards/f4vi1/include/periph_conf.h +++ b/boards/f4vi1/include/periph_conf.h @@ -51,31 +51,30 @@ extern "C" { /** @} */ /** - * @name Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (2U) -#define TIMER_0_EN 1 -#define TIMER_1_EN 1 -#define TIMER_IRQ_PRIO 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV TIM2 -#define TIMER_0_CHANNELS 4 -#define TIMER_0_FREQ (CLOCK_CORECLOCK / 2) -#define TIMER_0_MAX_VALUE (0xffffffff) -#define TIMER_0_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_TIM2EN) +static const timer_conf_t timer_config[] = { + { + .dev = TIM2, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM2EN, + .bus = APB1, + .irqn = TIM2_IRQn + }, + { + .dev = TIM5, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM5EN, + .bus = APB1, + .irqn = TIM5_IRQn + } +}; + #define TIMER_0_ISR isr_tim2 -#define TIMER_0_IRQ_CHAN TIM2_IRQn - -/* Timer 1 configuration */ -#define TIMER_1_DEV TIM5 -#define TIMER_1_CHANNELS 4 -#define TIMER_1_FREQ (CLOCK_CORECLOCK / 2) -#define TIMER_1_MAX_VALUE (0xffffffff) -#define TIMER_1_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_TIM5EN) #define TIMER_1_ISR isr_tim5 -#define TIMER_1_IRQ_CHAN TIM5_IRQn + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/fox/include/periph_conf.h b/boards/fox/include/periph_conf.h index 1796c5fc17f5efa35785992849792f9131db5b2e..e3198aab35a8546a2b11799e30df1b86122e2395 100644 --- a/boards/fox/include/periph_conf.h +++ b/boards/fox/include/periph_conf.h @@ -67,12 +67,14 @@ extern "C" { static const timer_conf_t timer_config[] = { { .dev = TIM2, + .max = 0x0000ffff, .rcc_mask = RCC_APB1ENR_TIM2EN, .bus = APB1, .irqn = TIM2_IRQn }, { .dev = TIM3, + .max = 0x0000ffff, .rcc_mask = RCC_APB1ENR_TIM3EN, .bus = APB1, .irqn = TIM3_IRQn diff --git a/boards/iotlab-common/include/periph_conf_common.h b/boards/iotlab-common/include/periph_conf_common.h index f1734792c0d345677915b4870a67f46ec00e2f4f..5ce6492258f55b0640edb5099ec3aa4ae81f9adf 100644 --- a/boards/iotlab-common/include/periph_conf_common.h +++ b/boards/iotlab-common/include/periph_conf_common.h @@ -68,12 +68,14 @@ extern "C" { static const timer_conf_t timer_config[] = { { .dev = TIM2, + .max = 0x0000ffff, .rcc_mask = RCC_APB1ENR_TIM2EN, .bus = APB1, .irqn = TIM2_IRQn }, { .dev = TIM3, + .max = 0x0000ffff, .rcc_mask = RCC_APB1ENR_TIM3EN, .bus = APB1, .irqn = TIM3_IRQn diff --git a/boards/msbiot/include/periph_conf.h b/boards/msbiot/include/periph_conf.h index cc7f5596a255c74b9d8602d1fbe40a802213c29e..e6eadc1364c37787851f6fbcdfe00cb604785e9d 100644 --- a/boards/msbiot/include/periph_conf.h +++ b/boards/msbiot/include/periph_conf.h @@ -48,33 +48,31 @@ extern "C" { #define CLOCK_APB1 (CLOCK_CORECLOCK / 4) /** @} */ - /** - * @name Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (2U) -#define TIMER_0_EN 1 -#define TIMER_1_EN 1 -#define TIMER_IRQ_PRIO 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV TIM2 -#define TIMER_0_CHANNELS 4 -#define TIMER_0_FREQ (84000000U) -#define TIMER_0_MAX_VALUE (0xffffffff) -#define TIMER_0_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_TIM2EN) +static const timer_conf_t timer_config[] = { + { + .dev = TIM2, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM2EN, + .bus = APB1, + .irqn = TIM2_IRQn + }, + { + .dev = TIM5, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM5EN, + .bus = APB1, + .irqn = TIM5_IRQn + } +}; + #define TIMER_0_ISR isr_tim2 -#define TIMER_0_IRQ_CHAN TIM2_IRQn - -/* Timer 1 configuration */ -#define TIMER_1_DEV TIM5 -#define TIMER_1_CHANNELS 4 -#define TIMER_1_FREQ (84000000U) -#define TIMER_1_MAX_VALUE (0xffffffff) -#define TIMER_1_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_TIM5EN) #define TIMER_1_ISR isr_tim5 -#define TIMER_1_IRQ_CHAN TIM5_IRQn + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/nucleo-f030/include/periph_conf.h b/boards/nucleo-f030/include/periph_conf.h index 1bd7f9cfd248e9992ddf063ad5056852e64dafe7..a2df78bd1a7f67371738e4cefee9a251b1eea029 100644 --- a/boards/nucleo-f030/include/periph_conf.h +++ b/boards/nucleo-f030/include/periph_conf.h @@ -21,6 +21,8 @@ #ifndef PERIPH_CONF_H_ #define PERIPH_CONF_H_ +#include "periph_cpu.h" + #ifdef __cplusplus extern "C" { #endif @@ -42,21 +44,22 @@ extern "C" { /** @} */ /** - * @brief Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (1U) -#define TIMER_0_EN 1 -#define TIMER_IRQ_PRIO 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV TIM3 -#define TIMER_0_CHANNELS 4 -#define TIMER_0_FREQ (CLOCK_CORECLOCK) -#define TIMER_0_MAX_VALUE (0x0000ffff) -#define TIMER_0_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_TIM3EN) -#define TIMER_0_IRQ_CHAN TIM3_IRQn +static const timer_conf_t timer_config[] = { + { + .dev = TIM3, + .max = 0x0000ffff, + .rcc_mask = RCC_APB1ENR_TIM3EN, + .bus = APB1, + .irqn = TIM3_IRQn + } +}; + #define TIMER_0_ISR isr_tim3 + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/nucleo-f070/include/periph_conf.h b/boards/nucleo-f070/include/periph_conf.h index a988a997413ceb1b27bb24f8d8e2de4d0993e431..0a077edbcaa9dbe78e6365ba35ccac0da3f38af5 100644 --- a/boards/nucleo-f070/include/periph_conf.h +++ b/boards/nucleo-f070/include/periph_conf.h @@ -21,6 +21,8 @@ #ifndef PERIPH_CONF_H_ #define PERIPH_CONF_H_ +#include "periph_cpu.h" + #ifdef __cplusplus extern "C" { #endif @@ -42,21 +44,22 @@ extern "C" { /** @} */ /** - * @brief Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (1U) -#define TIMER_0_EN 1 -#define TIMER_IRQ_PRIO 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV 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_TIM3EN) -#define TIMER_0_IRQ_CHAN TIM3_IRQn +static const timer_conf_t timer_config[] = { + { + .dev = TIM3, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM3EN, + .bus = APB1, + .irqn = TIM3_IRQn + } +}; + #define TIMER_0_ISR isr_tim3 + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/nucleo-f072/include/periph_conf.h b/boards/nucleo-f072/include/periph_conf.h index ab55e8c46bcb45deb2cdba8afb2e73e0ae10f541..28e77ab738d4d3b95c5c1b218e23e81b8b57fec3 100644 --- a/boards/nucleo-f072/include/periph_conf.h +++ b/boards/nucleo-f072/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 @@ -41,21 +43,22 @@ extern "C" { /** @} */ /** - * @brief Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (1U) -#define TIMER_0_EN 1 -#define TIMER_IRQ_PRIO 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV TIM2 -#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) -#define TIMER_0_IRQ_CHAN TIM2_IRQn +static const timer_conf_t timer_config[] = { + { + .dev = TIM2, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM2EN, + .bus = APB1, + .irqn = TIM2_IRQn + } +}; + #define TIMER_0_ISR isr_tim2 + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/nucleo-f091/include/periph_conf.h b/boards/nucleo-f091/include/periph_conf.h index 4ff995b0d270f4e09baf3bd8c141223d517d074c..01bfb369ad7dc00923baea4459859d3033b7d397 100644 --- a/boards/nucleo-f091/include/periph_conf.h +++ b/boards/nucleo-f091/include/periph_conf.h @@ -42,21 +42,22 @@ extern "C" { /** @} */ /** - * @brief Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (1U) -#define TIMER_0_EN 1 -#define TIMER_IRQ_PRIO 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV TIM2 -#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) -#define TIMER_0_IRQ_CHAN TIM2_IRQn +static const timer_conf_t timer_config[] = { + { + .dev = TIM2, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM2EN, + .bus = APB1, + .irqn = TIM2_IRQn + } +}; + #define TIMER_0_ISR isr_tim2 + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/nucleo-f103/include/periph_conf.h b/boards/nucleo-f103/include/periph_conf.h index 5412f9c11e9be4cb06e5b3015c52348719d28bc5..feb31718a4fb23e3d241d4e43b408cc2e65b0c5f 100644 --- a/boards/nucleo-f103/include/periph_conf.h +++ b/boards/nucleo-f103/include/periph_conf.h @@ -68,12 +68,15 @@ extern "C" { static const timer_conf_t timer_config[] = { { .dev = TIM2, + .max = 0x0000ffff, .rcc_mask = RCC_APB1ENR_TIM2EN, .bus = APB1, .irqn = TIM2_IRQn }, { .dev = TIM3, + .max = 0x0000ffff, + .rcc_mask = RCC_APB1ENR_TIM3EN, .bus = APB1, .irqn = TIM3_IRQn diff --git a/boards/nucleo-f207/include/periph_conf.h b/boards/nucleo-f207/include/periph_conf.h index 6a2d118aa80da20d0e705258051b9df9ea9288e1..a8679b0c6aee1aac19926e79c314ce2a41003b7a 100644 --- a/boards/nucleo-f207/include/periph_conf.h +++ b/boards/nucleo-f207/include/periph_conf.h @@ -73,52 +73,37 @@ static const pwm_conf_t pwm_config[PWM_NUMOF] = { /** @} */ /** - * @name Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (4U) -#define TIMER_0_EN 1 -#define TIMER_1_EN 1 -#define TIMER_2_EN 1 -#define TIMER_3_EN 1 -#define TIMER_IRQ_PRIO 1 - -static const timer_conf_t timer_config[TIMER_NUMOF] = { +static const timer_conf_t timer_config[] = { { .dev = TIM2, - .channels = 4, - .freq = (CLOCK_APB1 * 2), + .max = 0xffffffff, .rcc_mask = RCC_APB1ENR_TIM2EN, .bus = APB1, - .irqn = TIM2_IRQn, - .priority = TIMER_IRQ_PRIO + .irqn = TIM2_IRQn }, { .dev = TIM5, - .channels = 4, - .freq = (CLOCK_APB1 * 2), + .max = 0xffffffff, .rcc_mask = RCC_APB1ENR_TIM5EN, .bus = APB1, - .irqn = TIM5_IRQn, - .priority = TIMER_IRQ_PRIO + .irqn = TIM5_IRQn }, { .dev = TIM3, - .channels = 4, - .freq = (CLOCK_APB1 * 2), + .max = 0xffffffff, .rcc_mask = RCC_APB1ENR_TIM3EN, .bus = APB1, - .irqn = TIM3_IRQn, - .priority = TIMER_IRQ_PRIO + .irqn = TIM3_IRQn }, { .dev = TIM4, - .channels = 4, - .freq = (CLOCK_APB1 * 2), + .max = 0xffffffff, .rcc_mask = RCC_APB1ENR_TIM4EN, .bus = APB1, - .irqn = TIM4_IRQn, - .priority = TIMER_IRQ_PRIO + .irqn = TIM4_IRQn } }; @@ -126,6 +111,8 @@ static const timer_conf_t timer_config[TIMER_NUMOF] = { #define TIMER_1_ISR isr_tim5 #define TIMER_2_ISR isr_tim3 #define TIMER_3_ISR isr_tim4 + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/nucleo-f303/include/periph_conf.h b/boards/nucleo-f303/include/periph_conf.h index aed1276eea059a1e740c68703c00d04eccdb658f..249df3fc459ee94a5870e0e5b158dd5d1c52ad03 100755 --- a/boards/nucleo-f303/include/periph_conf.h +++ b/boards/nucleo-f303/include/periph_conf.h @@ -21,6 +21,8 @@ #ifndef PERIPH_CONF_H_ #define PERIPH_CONF_H_ +#include "periph_cpu.h" + #ifdef __cplusplus extern "C" { #endif @@ -53,21 +55,22 @@ extern "C" { /** @} */ /** - * @brief Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (1U) -#define TIMER_0_EN 1 -#define TIMER_IRQ_PRIO 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV TIM2 -#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) -#define TIMER_0_IRQ_CHAN TIM2_IRQn +static const timer_conf_t timer_config[] = { + { + .dev = TIM2, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM2EN, + .bus = APB1, + .irqn = TIM2_IRQn + } +}; + #define TIMER_0_ISR isr_tim2 + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/nucleo-f334/include/periph_conf.h b/boards/nucleo-f334/include/periph_conf.h index 99e2da73f5b3d59294f43e991a4d4b0565c24360..5167710ce0a5d1f2c8a756beb3eb15bc405d037f 100644 --- a/boards/nucleo-f334/include/periph_conf.h +++ b/boards/nucleo-f334/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 @@ -51,22 +53,30 @@ extern "C" { #define DAC_NUMOF (0) /** @} */ +/** + * @brief DAC configuration + * @{ + */ +#define DAC_NUMOF (0) +/** @} */ + /** * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (1U) -#define TIMER_0_EN 1 -#define TIMER_IRQ_PRIO 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV TIM2 -#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) -#define TIMER_0_ISR isr_tim2 -#define TIMER_0_IRQ_CHAN TIM2_IRQn +static const timer_conf_t timer_config[] = { + { + .dev = TIM2, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM2EN, + .bus = APB1, + .irqn = TIM2_IRQn + } +}; + +#define TIMER_0_ISR (isr_tim2) + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/nucleo-f401/include/board.h b/boards/nucleo-f401/include/board.h index 9df74ec0efc5b6dc6611d3dc925330641502ae6b..6e2be0642aac5785de2db2d57cca8db460b04d30 100644 --- a/boards/nucleo-f401/include/board.h +++ b/boards/nucleo-f401/include/board.h @@ -31,7 +31,7 @@ extern "C" { * @name xtimer configuration * @{ */ -#define XTIMER_DEV TIMER_0 +#define XTIMER_DEV TIMER_DEV(0) #define XTIMER_CHAN (0) #define XTIMER_OVERHEAD (6) #define XTIMER_BACKOFF (5) diff --git a/boards/nucleo-f401/include/periph_conf.h b/boards/nucleo-f401/include/periph_conf.h index 49915b525735926437aaa07636ef73defbc02fb2..a8e2115ec362eff05f499cdd0d811d96bb2811a5 100644 --- a/boards/nucleo-f401/include/periph_conf.h +++ b/boards/nucleo-f401/include/periph_conf.h @@ -49,31 +49,30 @@ extern "C" { /** @} */ /** - * @name Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (2U) -#define TIMER_0_EN 1 -#define TIMER_1_EN 1 -#define TIMER_IRQ_PRIO 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV TIM2 -#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) +static const timer_conf_t timer_config[] = { + { + .dev = TIM2, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM2EN, + .bus = APB1, + .irqn = TIM2_IRQn + }, + { + .dev = TIM5, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM5EN, + .bus = APB1, + .irqn = TIM5_IRQn + } +}; + #define TIMER_0_ISR isr_tim2 -#define TIMER_0_IRQ_CHAN TIM2_IRQn - -/* Timer 1 configuration */ -#define TIMER_1_DEV 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_TIM5EN) #define TIMER_1_ISR isr_tim5 -#define TIMER_1_IRQ_CHAN TIM5_IRQn + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/nucleo-f446/include/board.h b/boards/nucleo-f446/include/board.h index ebe8b92a08951f842a6c8021141abc6d4c8d403e..1c9143a094e3207f13d48a8ef0f66439a2153024 100644 --- a/boards/nucleo-f446/include/board.h +++ b/boards/nucleo-f446/include/board.h @@ -31,7 +31,7 @@ extern "C" { * @name xtimer configuration * @{ */ -#define XTIMER_DEV TIMER_0 +#define XTIMER_DEV TIMER_DEV(0) #define XTIMER_CHAN (0) #define XTIMER_OVERHEAD (6) #define XTIMER_BACKOFF (5) diff --git a/boards/nucleo-f446/include/periph_conf.h b/boards/nucleo-f446/include/periph_conf.h index d4a2d093bec93ebbe329ff7197a4c7a2165e818b..fa2703181bb24d7370aba718ac034645efa3fb2a 100644 --- a/boards/nucleo-f446/include/periph_conf.h +++ b/boards/nucleo-f446/include/periph_conf.h @@ -49,31 +49,30 @@ extern "C" { /** @} */ /** - * @name Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (2U) -#define TIMER_0_EN 1 -#define TIMER_1_EN 1 -#define TIMER_IRQ_PRIO 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV TIM2 -#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) +static const timer_conf_t timer_config[] = { + { + .dev = TIM2, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM2EN, + .bus = APB1, + .irqn = TIM2_IRQn + }, + { + .dev = TIM5, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM5EN, + .bus = APB1, + .irqn = TIM5_IRQn + } +}; + #define TIMER_0_ISR isr_tim2 -#define TIMER_0_IRQ_CHAN TIM2_IRQn - -/* Timer 1 configuration */ -#define TIMER_1_DEV 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_TIM5EN) #define TIMER_1_ISR isr_tim5 -#define TIMER_1_IRQ_CHAN TIM5_IRQn + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/nucleo-l1/include/periph_conf.h b/boards/nucleo-l1/include/periph_conf.h index b817a9247b4b9adf1281ecb2b5f3142ed6266490..52d27d3c8d50fa280c6bf288b7523a325163bc28 100644 --- a/boards/nucleo-l1/include/periph_conf.h +++ b/boards/nucleo-l1/include/periph_conf.h @@ -60,12 +60,17 @@ extern "C" { * @{ */ static const timer_conf_t timer_config[] = { - /* device, RCC bit, IRQ bit */ - {TIM5, 3, TIM5_IRQn}, + { + .dev = TIM5, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM5EN, + .bus = APB1, + .irqn = TIM5_IRQn + } }; -/* interrupt routines */ + #define TIMER_0_ISR (isr_tim5) -/* number of defined timers */ + #define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ diff --git a/boards/spark-core/include/periph_conf.h b/boards/spark-core/include/periph_conf.h index a495db8f03383ae381677a8583b10e32026dc016..80ff806d041852a110ccea097639b318ba4d04a3 100644 --- a/boards/spark-core/include/periph_conf.h +++ b/boards/spark-core/include/periph_conf.h @@ -67,12 +67,14 @@ static const timer_conf_t timer_config[] = { { .dev = TIM2, + .max = 0x0000ffff, .rcc_mask = RCC_APB1ENR_TIM2EN, .bus = APB1, .irqn = TIM2_IRQn }, { .dev = TIM3, + .max = 0x0000ffff, .rcc_mask = RCC_APB1ENR_TIM3EN, .bus = APB1, .irqn = TIM3_IRQn diff --git a/boards/stm32f0discovery/include/periph_conf.h b/boards/stm32f0discovery/include/periph_conf.h index 9ca2befe72ba1cc5c38ad9a304f0530ade6a74b5..4c2027c0d78f00dfcbdae10f72fe0e9afa8ed92a 100644 --- a/boards/stm32f0discovery/include/periph_conf.h +++ b/boards/stm32f0discovery/include/periph_conf.h @@ -42,21 +42,22 @@ extern "C" { /** @} */ /** - * @name Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (1U) -#define TIMER_0_EN 1 -#define TIMER_IRQ_PRIO 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV TIM2 -#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) +static const timer_conf_t timer_config[] = { + { + .dev = TIM2, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM2EN, + .bus = APB1, + .irqn = TIM2_IRQn + } +}; + #define TIMER_0_ISR isr_tim2 -#define TIMER_0_IRQ_CHAN TIM2_IRQn + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/stm32f3discovery/include/periph_conf.h b/boards/stm32f3discovery/include/periph_conf.h index 0dd14045d2943482b1e93b3b317de51e7b0b0afd..22e3bdf5f0146a506040c8411727cbe845aa7738 100644 --- a/boards/stm32f3discovery/include/periph_conf.h +++ b/boards/stm32f3discovery/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 @@ -55,21 +57,22 @@ extern "C" { /** @} */ /** - * @brief Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (1U) -#define TIMER_0_EN 1 -#define TIMER_IRQ_PRIO 1 +static const timer_conf_t timer_config[] = { + { + .dev = TIM2, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM2EN, + .bus = APB1, + .irqn = TIM2_IRQn + } +}; -/* Timer 0 configuration */ -#define TIMER_0_DEV TIM2 -#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) #define TIMER_0_ISR isr_tim2 -#define TIMER_0_IRQ_CHAN TIM2_IRQn + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** diff --git a/boards/stm32f4discovery/include/board.h b/boards/stm32f4discovery/include/board.h index 41925c1409a32b1de92b3bab6c01ab9330ba9b7f..98c95f1148d37c712f5919115f13b74907bb95e6 100644 --- a/boards/stm32f4discovery/include/board.h +++ b/boards/stm32f4discovery/include/board.h @@ -32,7 +32,7 @@ extern "C" { * @name xtimer configuration * @{ */ -#define XTIMER_DEV TIMER_0 +#define XTIMER_DEV TIMER_DEV(0) #define XTIMER_CHAN (0) #define XTIMER_OVERHEAD (6) #define XTIMER_BACKOFF (10) diff --git a/boards/stm32f4discovery/include/periph_conf.h b/boards/stm32f4discovery/include/periph_conf.h index 264742e349a243c850c706d163278eaa0a7ea4b8..c25a03b31778bd9822d0e78ecd266a366cb2a68e 100644 --- a/boards/stm32f4discovery/include/periph_conf.h +++ b/boards/stm32f4discovery/include/periph_conf.h @@ -50,31 +50,30 @@ extern "C" { /** @} */ /** - * @name Timer configuration + * @brief Timer configuration * @{ */ -#define TIMER_NUMOF (2U) -#define TIMER_0_EN 1 -#define TIMER_1_EN 1 -#define TIMER_IRQ_PRIO 1 +static const timer_conf_t timer_config[] = { + { + .dev = TIM2, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM2EN, + .bus = APB1, + .irqn = TIM2_IRQn + }, + { + .dev = TIM5, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM5EN, + .bus = APB1, + .irqn = TIM5_IRQn + } +}; -/* Timer 0 configuration */ -#define TIMER_0_DEV TIM2 -#define TIMER_0_CHANNELS 4 -#define TIMER_0_FREQ (CLOCK_CORECLOCK / 2) -#define TIMER_0_MAX_VALUE (0xffffffff) -#define TIMER_0_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_TIM2EN) #define TIMER_0_ISR isr_tim2 -#define TIMER_0_IRQ_CHAN TIM2_IRQn - -/* Timer 1 configuration */ -#define TIMER_1_DEV TIM5 -#define TIMER_1_CHANNELS 4 -#define TIMER_1_FREQ (CLOCK_CORECLOCK / 2) -#define TIMER_1_MAX_VALUE (0xffffffff) -#define TIMER_1_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_TIM5EN) #define TIMER_1_ISR isr_tim5 -#define TIMER_1_IRQ_CHAN TIM5_IRQn + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) /** @} */ /** @@ -103,7 +102,7 @@ static const uart_conf_t uart_config[] = { .irqn = USART3_IRQn, .dma_stream = 3, .dma_chan = 4 - }, + } }; /* assign ISR vector names */