diff --git a/boards/b-l072z-lrwan1/include/periph_conf.h b/boards/b-l072z-lrwan1/include/periph_conf.h index fb4b4a81c3..2b3b6292d9 100644 --- a/boards/b-l072z-lrwan1/include/periph_conf.h +++ b/boards/b-l072z-lrwan1/include/periph_conf.h @@ -23,6 +23,7 @@ #include "l0/cfg_clock_32_16_1.h" #include "cfg_rtt_default.h" #include "cfg_i2c1_pb8_pb9.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -50,25 +51,6 @@ static const dma_conf_t dma_config[] = { #endif /** @} */ -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM2, - .max = 0x0000ffff, - .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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/common/stm32/include/cfg_timer_tim2.h b/boards/common/stm32/include/cfg_timer_tim2.h new file mode 100644 index 0000000000..9590ae32c9 --- /dev/null +++ b/boards/common/stm32/include/cfg_timer_tim2.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2019 Inria + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup boards_common_stm32 + * @{ + * + * @file + * @brief Common configuration for STM32 Timer peripheral based on TIM2 + * + * @author Alexandre Abadie + */ + +#ifndef CFG_TIMER_TIM2_H +#define CFG_TIMER_TIM2_H + +#include "periph_cpu.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name Timer configuration + * @{ + */ +static const timer_conf_t timer_config[] = { + { + .dev = TIM2, +#if defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1) + .max = 0x0000ffff, +#else + .max = 0xffffffff, +#endif +#if CPU_FAM_STM32L4 + .rcc_mask = RCC_APB1ENR1_TIM2EN, +#else + .rcc_mask = RCC_APB1ENR_TIM2EN, +#endif + .bus = APB1, + .irqn = TIM2_IRQn + } +}; + +#define TIMER_0_ISR isr_tim2 + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* CFG_TIMER_TIM2_H */ +/** @} */ diff --git a/boards/common/stm32/include/cfg_timer_tim5.h b/boards/common/stm32/include/cfg_timer_tim5.h new file mode 100644 index 0000000000..021ba6e528 --- /dev/null +++ b/boards/common/stm32/include/cfg_timer_tim5.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2019 Inria + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup boards_common_stm32 + * @{ + * + * @file + * @brief Common configuration for STM32 Timer peripheral based on TIM5 + * + * @author Alexandre Abadie + */ + +#ifndef CFG_TIMER_TIM5_H +#define CFG_TIMER_TIM5_H + +#include "periph_cpu.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name Timer configuration + * @{ + */ +static const timer_conf_t timer_config[] = { + { + .dev = TIM5, + .max = 0xffffffff, + .rcc_mask = RCC_APB1ENR_TIM5EN, + .bus = APB1, + .irqn = TIM5_IRQn + } +}; + +#define TIMER_0_ISR isr_tim5 + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* CFG_TIMER_TIM5_H */ +/** @} */ diff --git a/boards/i-nucleo-lrwan1/include/periph_conf.h b/boards/i-nucleo-lrwan1/include/periph_conf.h index ee86a9ec34..1b867497d6 100644 --- a/boards/i-nucleo-lrwan1/include/periph_conf.h +++ b/boards/i-nucleo-lrwan1/include/periph_conf.h @@ -22,30 +22,12 @@ #include "periph_cpu.h" #include "l0/cfg_clock_32_16_1.h" #include "cfg_rtt_default.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM2, - .max = 0x0000ffff, - .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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/lobaro-lorabox/Makefile.include b/boards/lobaro-lorabox/Makefile.include index fe3ff9316a..ab0bcab31d 100644 --- a/boards/lobaro-lorabox/Makefile.include +++ b/boards/lobaro-lorabox/Makefile.include @@ -3,7 +3,7 @@ export CPU = stm32l1 export CPU_MODEL = stm32l151cb_a # add the common header files to the include path -INCLUDES += -I$(RIOTBOARD)/lobaro-lorabox/include +INCLUDES += -I$(RIOTBOARD)/common/stm32/include # configure the serial terminal PORT_LINUX ?= /dev/ttyUSB0 diff --git a/boards/lobaro-lorabox/include/periph_conf.h b/boards/lobaro-lorabox/include/periph_conf.h index 30a727f2ba..38f0c51887 100644 --- a/boards/lobaro-lorabox/include/periph_conf.h +++ b/boards/lobaro-lorabox/include/periph_conf.h @@ -25,6 +25,7 @@ #define PERIPH_CONF_H #include "periph_cpu.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -70,25 +71,6 @@ extern "C" { #define CLOCK_APB1 (CLOCK_CORECLOCK / 1) /** @} */ -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM2, - .max = 0x0000ffff, - .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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/lsn50/include/periph_conf.h b/boards/lsn50/include/periph_conf.h index 514848ce0a..889dbdeae6 100644 --- a/boards/lsn50/include/periph_conf.h +++ b/boards/lsn50/include/periph_conf.h @@ -22,6 +22,7 @@ #include "periph_cpu.h" #include "l0/cfg_clock_32_16_1.h" #include "cfg_rtt_default.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -49,25 +50,6 @@ static const dma_conf_t dma_config[] = { #endif /** @} */ -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM2, - .max = 0x0000ffff, - .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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f031k6/include/periph_conf.h b/boards/nucleo-f031k6/include/periph_conf.h index ed5b8df88b..8a981f615b 100644 --- a/boards/nucleo-f031k6/include/periph_conf.h +++ b/boards/nucleo-f031k6/include/periph_conf.h @@ -21,6 +21,7 @@ #define PERIPH_CONF_H #include "periph_cpu.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -54,25 +55,6 @@ extern "C" { #define CLOCK_PLL_MUL (12) /** @} */ -/** - * @name Timer configuration - * @{ - */ -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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f042k6/include/periph_conf.h b/boards/nucleo-f042k6/include/periph_conf.h index 2477916fa1..201ccad0b7 100644 --- a/boards/nucleo-f042k6/include/periph_conf.h +++ b/boards/nucleo-f042k6/include/periph_conf.h @@ -20,6 +20,7 @@ #define PERIPH_CONF_H #include "periph_cpu.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -53,26 +54,6 @@ extern "C" { #define CLOCK_PLL_MUL (12) /** @} */ - -/** - * @name Timer configuration - * @{ - */ -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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f302r8/include/periph_conf.h b/boards/nucleo-f302r8/include/periph_conf.h index 5e92edb403..006e22f3f0 100644 --- a/boards/nucleo-f302r8/include/periph_conf.h +++ b/boards/nucleo-f302r8/include/periph_conf.h @@ -24,6 +24,7 @@ #define PERIPH_CONF_H #include "periph_cpu.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -58,25 +59,6 @@ extern "C" { #define CLOCK_PLL_MUL (9) /** @} */ -/** - * @name Timer configuration - * @{ - */ -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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f303k8/include/periph_conf.h b/boards/nucleo-f303k8/include/periph_conf.h index de9e586d6d..74e162dc61 100644 --- a/boards/nucleo-f303k8/include/periph_conf.h +++ b/boards/nucleo-f303k8/include/periph_conf.h @@ -20,6 +20,7 @@ #define PERIPH_CONF_H #include "periph_cpu.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -54,25 +55,6 @@ extern "C" { #define CLOCK_PLL_MUL (16) /** @} */ -/** - * @name Timer configuration - * @{ - */ -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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f303re/include/periph_conf.h b/boards/nucleo-f303re/include/periph_conf.h index 337d46caf6..9b8f0155e4 100644 --- a/boards/nucleo-f303re/include/periph_conf.h +++ b/boards/nucleo-f303re/include/periph_conf.h @@ -22,6 +22,7 @@ #define PERIPH_CONF_H #include "periph_cpu.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -56,25 +57,6 @@ extern "C" { #define CLOCK_PLL_MUL (9) /** @} */ -/** - * @name Timer configuration - * @{ - */ -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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f303ze/include/periph_conf.h b/boards/nucleo-f303ze/include/periph_conf.h index eb58955727..d602951176 100644 --- a/boards/nucleo-f303ze/include/periph_conf.h +++ b/boards/nucleo-f303ze/include/periph_conf.h @@ -20,6 +20,7 @@ #define PERIPH_CONF_H #include "periph_cpu.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -54,25 +55,6 @@ extern "C" { #define CLOCK_PLL_MUL (9) /** @} */ -/** - * @name Timer configuration - * @{ - */ -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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f334r8/include/periph_conf.h b/boards/nucleo-f334r8/include/periph_conf.h index b9b213d195..c3af0285dd 100644 --- a/boards/nucleo-f334r8/include/periph_conf.h +++ b/boards/nucleo-f334r8/include/periph_conf.h @@ -21,6 +21,7 @@ #define PERIPH_CONF_H #include "periph_cpu.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -55,25 +56,6 @@ extern "C" { #define CLOCK_PLL_MUL (9) /** @} */ -/** - * @name Timer configuration - * @{ - */ -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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f401re/include/periph_conf.h b/boards/nucleo-f401re/include/periph_conf.h index 7abb56219e..378f7762de 100644 --- a/boards/nucleo-f401re/include/periph_conf.h +++ b/boards/nucleo-f401re/include/periph_conf.h @@ -22,30 +22,12 @@ #include "periph_cpu.h" #include "f4/cfg_clock_84_8_1.h" #include "cfg_i2c1_pb8_pb9.h" +#include "cfg_timer_tim5.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM5, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR_TIM5EN, - .bus = APB1, - .irqn = TIM5_IRQn - } -}; - -#define TIMER_0_ISR isr_tim5 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f410rb/include/periph_conf.h b/boards/nucleo-f410rb/include/periph_conf.h index 4519da3594..13f6d80514 100644 --- a/boards/nucleo-f410rb/include/periph_conf.h +++ b/boards/nucleo-f410rb/include/periph_conf.h @@ -22,30 +22,12 @@ #include "periph_cpu.h" #include "f4/cfg_clock_96_8_1.h" #include "cfg_i2c1_pb8_pb9.h" +#include "cfg_timer_tim5.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM5, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR_TIM5EN, - .bus = APB1, - .irqn = TIM5_IRQn - } -}; - -#define TIMER_0_ISR isr_tim5 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f411re/include/periph_conf.h b/boards/nucleo-f411re/include/periph_conf.h index 43e6d24ec2..fe29aec112 100644 --- a/boards/nucleo-f411re/include/periph_conf.h +++ b/boards/nucleo-f411re/include/periph_conf.h @@ -22,31 +22,12 @@ #include "periph_cpu.h" #include "f4/cfg_clock_96_8_1.h" #include "cfg_i2c1_pb8_pb9.h" +#include "cfg_timer_tim5.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM5, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR_TIM5EN, - .bus = APB1, - .irqn = TIM5_IRQn - } -}; - -#define TIMER_0_ISR isr_tim5 -#define TIMER_1_ISR isr_tim4 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f412zg/include/periph_conf.h b/boards/nucleo-f412zg/include/periph_conf.h index f5127ae6d5..d8b0660293 100644 --- a/boards/nucleo-f412zg/include/periph_conf.h +++ b/boards/nucleo-f412zg/include/periph_conf.h @@ -24,30 +24,12 @@ #include "periph_cpu.h" #include "f4/cfg_clock_100_8_1.h" #include "cfg_i2c1_pb8_pb9.h" +#include "cfg_timer_tim5.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM5, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR_TIM5EN, - .bus = APB1, - .irqn = TIM5_IRQn - } -}; - -#define TIMER_0_ISR isr_tim5 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f413zh/include/periph_conf.h b/boards/nucleo-f413zh/include/periph_conf.h index bb261f308d..a94e06ad8c 100644 --- a/boards/nucleo-f413zh/include/periph_conf.h +++ b/boards/nucleo-f413zh/include/periph_conf.h @@ -24,6 +24,7 @@ #include "periph_cpu.h" #include "f4/cfg_clock_100_8_1.h" #include "cfg_i2c1_pb8_pb9.h" +#include "cfg_timer_tim5.h" #ifdef __cplusplus extern "C" { @@ -52,25 +53,6 @@ static const dma_conf_t dma_config[] = { #endif /** @} */ -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM5, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR_TIM5EN, - .bus = APB1, - .irqn = TIM5_IRQn - } -}; - -#define TIMER_0_ISR isr_tim5 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f429zi/include/periph_conf.h b/boards/nucleo-f429zi/include/periph_conf.h index 47eda1927b..cfe91fd337 100644 --- a/boards/nucleo-f429zi/include/periph_conf.h +++ b/boards/nucleo-f429zi/include/periph_conf.h @@ -23,30 +23,12 @@ #include "f4/cfg_clock_168_8_1.h" #include "cfg_i2c1_pb8_pb9.h" #include "cfg_spi_divtable.h" +#include "cfg_timer_tim5.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM5, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR_TIM5EN, - .bus = APB1, - .irqn = TIM5_IRQn - } -}; - -#define TIMER_0_ISR isr_tim5 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f446re/include/periph_conf.h b/boards/nucleo-f446re/include/periph_conf.h index 27d6139e0c..ca41c7ab24 100644 --- a/boards/nucleo-f446re/include/periph_conf.h +++ b/boards/nucleo-f446re/include/periph_conf.h @@ -23,30 +23,12 @@ #include "f4/cfg_clock_180_8_1.h" #include "cfg_i2c1_pb8_pb9.h" #include "cfg_spi_divtable.h" +#include "cfg_timer_tim5.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM5, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR_TIM5EN, - .bus = APB1, - .irqn = TIM5_IRQn - } -}; - -#define TIMER_0_ISR isr_tim5 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f446ze/include/periph_conf.h b/boards/nucleo-f446ze/include/periph_conf.h index 2535b9162d..f126625bf0 100644 --- a/boards/nucleo-f446ze/include/periph_conf.h +++ b/boards/nucleo-f446ze/include/periph_conf.h @@ -23,30 +23,12 @@ #include "f4/cfg_clock_180_8_1.h" #include "cfg_i2c1_pb8_pb9.h" #include "cfg_spi_divtable.h" +#include "cfg_timer_tim5.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM5, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR_TIM5EN, - .bus = APB1, - .irqn = TIM5_IRQn - } -}; - -#define TIMER_0_ISR isr_tim5 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f722ze/include/periph_conf.h b/boards/nucleo-f722ze/include/periph_conf.h index c6023183ee..252ed02403 100644 --- a/boards/nucleo-f722ze/include/periph_conf.h +++ b/boards/nucleo-f722ze/include/periph_conf.h @@ -23,30 +23,12 @@ #include "f7/cfg_clock_216_8_1.h" #include "cfg_i2c1_pb8_pb9.h" #include "cfg_rtt_default.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f746zg/include/periph_conf.h b/boards/nucleo-f746zg/include/periph_conf.h index 171cc8a665..bb0bbc31cf 100644 --- a/boards/nucleo-f746zg/include/periph_conf.h +++ b/boards/nucleo-f746zg/include/periph_conf.h @@ -23,30 +23,12 @@ #include "f7/cfg_clock_216_8_1.h" #include "cfg_i2c1_pb8_pb9.h" #include "cfg_rtt_default.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-f767zi/include/periph_conf.h b/boards/nucleo-f767zi/include/periph_conf.h index bc597ff9fb..b5e1aff673 100644 --- a/boards/nucleo-f767zi/include/periph_conf.h +++ b/boards/nucleo-f767zi/include/periph_conf.h @@ -24,6 +24,7 @@ #include "cfg_i2c1_pb8_pb9.h" #include "cfg_spi_divtable.h" #include "cfg_rtt_default.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -50,25 +51,6 @@ static const dma_conf_t dma_config[] = { #endif /** @} */ -/** - * @name Timer configuration - * @{ - */ -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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-l031k6/include/periph_conf.h b/boards/nucleo-l031k6/include/periph_conf.h index a46ee2cde9..3bc471f2d6 100644 --- a/boards/nucleo-l031k6/include/periph_conf.h +++ b/boards/nucleo-l031k6/include/periph_conf.h @@ -24,30 +24,12 @@ #include "periph_cpu.h" #include "l0/cfg_clock_32_16_1.h" #include "cfg_rtt_default.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM2, - .max = 0x0000ffff, - .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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-l053r8/include/periph_conf.h b/boards/nucleo-l053r8/include/periph_conf.h index 143d334f8b..9c582446a1 100644 --- a/boards/nucleo-l053r8/include/periph_conf.h +++ b/boards/nucleo-l053r8/include/periph_conf.h @@ -24,30 +24,12 @@ #include "periph_cpu.h" #include "l0/cfg_clock_32_16_1.h" #include "cfg_rtt_default.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM2, - .max = 0x0000ffff, - .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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-l073rz/include/periph_conf.h b/boards/nucleo-l073rz/include/periph_conf.h index c02e9d6624..884413c6b4 100644 --- a/boards/nucleo-l073rz/include/periph_conf.h +++ b/boards/nucleo-l073rz/include/periph_conf.h @@ -24,30 +24,12 @@ #include "periph_cpu.h" #include "l0/cfg_clock_32_16_1.h" #include "cfg_rtt_default.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM2, - .max = 0x0000ffff, - .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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-l152re/include/periph_conf.h b/boards/nucleo-l152re/include/periph_conf.h index 0e9110b136..4b02fb1f3a 100644 --- a/boards/nucleo-l152re/include/periph_conf.h +++ b/boards/nucleo-l152re/include/periph_conf.h @@ -21,6 +21,7 @@ #define PERIPH_CONF_H #include "periph_cpu.h" +#include "cfg_timer_tim5.h" #ifdef __cplusplus extern "C" { @@ -81,25 +82,6 @@ static const dma_conf_t dma_config[] = { #endif /** @} */ -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM5, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR_TIM5EN, - .bus = APB1, - .irqn = TIM5_IRQn - } -}; - -#define TIMER_0_ISR (isr_tim5) - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-l432kc/include/periph_conf.h b/boards/nucleo-l432kc/include/periph_conf.h index bd5f0987ab..d383ff96e1 100644 --- a/boards/nucleo-l432kc/include/periph_conf.h +++ b/boards/nucleo-l432kc/include/periph_conf.h @@ -23,6 +23,7 @@ #include "periph_cpu.h" #include "cfg_rtt_default.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -72,25 +73,6 @@ extern "C" { #define CLOCK_APB2 (CLOCK_CORECLOCK / 2) /** @} */ -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM2, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR1_TIM2EN, - .bus = APB1, - .irqn = TIM2_IRQn - } -}; - -#define TIMER_0_ISR isr_tim2 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-l433rc/include/periph_conf.h b/boards/nucleo-l433rc/include/periph_conf.h index 4526c642da..16670b4d89 100644 --- a/boards/nucleo-l433rc/include/periph_conf.h +++ b/boards/nucleo-l433rc/include/periph_conf.h @@ -21,6 +21,7 @@ #include "periph_cpu.h" #include "cfg_rtt_default.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -81,25 +82,6 @@ extern "C" { #define CLOCK_APB2 (CLOCK_CORECLOCK / 2) /** @} */ -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM2, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR1_TIM2EN, - .bus = APB1, - .irqn = TIM2_IRQn - } -}; - -#define TIMER_0_ISR isr_tim2 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nucleo-l452re/include/periph_conf.h b/boards/nucleo-l452re/include/periph_conf.h index 83e5ae2fa5..47b0bc275d 100644 --- a/boards/nucleo-l452re/include/periph_conf.h +++ b/boards/nucleo-l452re/include/periph_conf.h @@ -27,6 +27,7 @@ #include "periph_cpu.h" #include "cfg_rtt_default.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -86,25 +87,6 @@ extern "C" { #define CLOCK_APB2 (CLOCK_CORECLOCK / 2) /** @} */ -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM2, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR1_TIM2EN, - .bus = APB1, - .irqn = TIM2_IRQn - } -}; - -#define TIMER_0_ISR isr_tim2 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nz32-sc151/Makefile.include b/boards/nz32-sc151/Makefile.include index e5e377cbea..2934e3c2fc 100644 --- a/boards/nz32-sc151/Makefile.include +++ b/boards/nz32-sc151/Makefile.include @@ -2,6 +2,9 @@ export CPU = stm32l1 export CPU_MODEL = stm32l151rc +# we use shared STM32 configuration snippets +INCLUDES += -I$(RIOTBOARD)/common/stm32/include + # define the default port depending on the host OS PORT_LINUX ?= /dev/ttyUSB0 PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) diff --git a/boards/nz32-sc151/include/periph_conf.h b/boards/nz32-sc151/include/periph_conf.h index 65d5d60014..c9b6aa2b39 100644 --- a/boards/nz32-sc151/include/periph_conf.h +++ b/boards/nz32-sc151/include/periph_conf.h @@ -20,6 +20,7 @@ #define PERIPH_CONF_H #include "periph_cpu.h" +#include "cfg_timer_tim5.h" #ifdef __cplusplus extern "C" { @@ -49,25 +50,6 @@ extern "C" { #define CLOCK_APB2 (CLOCK_CORECLOCK / 1) /** @} */ -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM5, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR_TIM5EN, - .bus = APB1, - .irqn = TIM5_IRQn - } -}; - -#define TIMER_0_ISR (isr_tim5) - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/stm32f429i-disc1/include/periph_conf.h b/boards/stm32f429i-disc1/include/periph_conf.h index ce3f1523f8..8301d04447 100644 --- a/boards/stm32f429i-disc1/include/periph_conf.h +++ b/boards/stm32f429i-disc1/include/periph_conf.h @@ -22,30 +22,12 @@ #include "periph_cpu.h" #include "f4/cfg_clock_168_8_1.h" #include "cfg_spi_divtable.h" +#include "cfg_timer_tim5.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM5, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR_TIM5EN, - .bus = APB1, - .irqn = TIM5_IRQn - } -}; - -#define TIMER_0_ISR isr_tim5 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/stm32f769i-disco/include/periph_conf.h b/boards/stm32f769i-disco/include/periph_conf.h index 2b9be38d7c..9c55d11997 100644 --- a/boards/stm32f769i-disco/include/periph_conf.h +++ b/boards/stm32f769i-disco/include/periph_conf.h @@ -21,6 +21,7 @@ #include "periph_cpu.h" #include "cfg_rtt_default.h" +#include "cfg_timer_tim2.h" #ifdef __cplusplus extern "C" { @@ -57,25 +58,6 @@ extern "C" { #define CLOCK_PLL_Q (9) /** @} */ -/** - * @name Timer configuration - * @{ - */ -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])) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/ublox-c030-u201/Makefile.include b/boards/ublox-c030-u201/Makefile.include index 964e8d0212..5d9010842b 100644 --- a/boards/ublox-c030-u201/Makefile.include +++ b/boards/ublox-c030-u201/Makefile.include @@ -2,6 +2,9 @@ export CPU = stm32f4 export CPU_MODEL = stm32f437vg +# we use shared STM32 configuration snippets +INCLUDES += -I$(RIOTBOARD)/common/stm32/include + # define the default port depending on the host OS PORT_LINUX ?= /dev/ttyACM0 PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) diff --git a/boards/ublox-c030-u201/include/periph_conf.h b/boards/ublox-c030-u201/include/periph_conf.h index 63f73ca620..1e94b578cc 100644 --- a/boards/ublox-c030-u201/include/periph_conf.h +++ b/boards/ublox-c030-u201/include/periph_conf.h @@ -20,6 +20,7 @@ #define PERIPH_CONF_H #include "periph_cpu.h" +#include "cfg_timer_tim5.h" #ifdef __cplusplus extern "C" { @@ -56,25 +57,6 @@ extern "C" { #define CLOCK_PLL_Q (7) /** @} */ -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = TIM5, - .max = 0xffffffff, - .rcc_mask = RCC_APB1ENR_TIM5EN, - .bus = APB1, - .irqn = TIM5_IRQn - } -}; - -#define TIMER_0_ISR isr_tim5 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name UART configuration * @{