diff --git a/boards/airfy-beacon/include/periph_conf.h b/boards/airfy-beacon/include/periph_conf.h index 87701380f1..664dc57fe6 100644 --- a/boards/airfy-beacon/include/periph_conf.h +++ b/boards/airfy-beacon/include/periph_conf.h @@ -21,8 +21,9 @@ #define PERIPH_CONF_H #include "periph_cpu.h" -#include "periph_conf_common.h" #include "cfg_clock_16_1.h" +#include "cfg_timer_012.h" +#include "cfg_rtt_default.h" #ifdef __cplusplus extern "C" { diff --git a/boards/calliope-mini/include/periph_conf.h b/boards/calliope-mini/include/periph_conf.h index 29a130fec3..3e59b6d331 100644 --- a/boards/calliope-mini/include/periph_conf.h +++ b/boards/calliope-mini/include/periph_conf.h @@ -22,46 +22,13 @@ #include "periph_cpu.h" #include "cfg_clock_16_0.h" +#include "cfg_timer_012.h" +#include "cfg_rtt_default.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = NRF_TIMER0, - .channels = 3, - .bitmode = TIMER_BITMODE_BITMODE_24Bit, - .irqn = TIMER0_IRQn - }, - { - .dev = NRF_TIMER1, - .channels = 3, - .bitmode = TIMER_BITMODE_BITMODE_16Bit, - .irqn = TIMER1_IRQn - } -}; - -#define TIMER_0_ISR isr_timer0 -#define TIMER_1_ISR isr_timer1 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - -/** - * @name Real time counter configuration - * @{ - */ -#define RTT_NUMOF (1U) -#define RTT_DEV (1) /* NRF_RTC1 */ -#define RTT_MAX_VALUE (0x00ffffff) -#define RTT_FREQUENCY (1024) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/common/nrf51/include/periph_conf_common.h b/boards/common/nrf51/include/cfg_rtt_default.h similarity index 55% rename from boards/common/nrf51/include/periph_conf_common.h rename to boards/common/nrf51/include/cfg_rtt_default.h index e4c296d305..a724bda430 100644 --- a/boards/common/nrf51/include/periph_conf_common.h +++ b/boards/common/nrf51/include/cfg_rtt_default.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2018 Inria + * 2019 Freie Universität Berlin * * 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 @@ -11,34 +12,19 @@ * @{ * * @file - * @brief Common peripheral MCU configuration for some nrf51 based boards + * @brief Shared default RTT configuration for nRF51-based boards * * @author Alexandre Abadie + * @author Hauke Petersen */ -#ifndef PERIPH_CONF_COMMON_H -#define PERIPH_CONF_COMMON_H - -#include "periph_cpu.h" +#ifndef CFG_RTT_DEFAULT_H +#define CFG_RTT_DEFAULT_H #ifdef __cplusplus - extern "C" { +extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - /* dev, channels, width */ - { NRF_TIMER0, 3, TIMER_BITMODE_BITMODE_24Bit, TIMER0_IRQn } -}; - -#define TIMER_0_ISR isr_timer0 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - /** * @name Real time counter configuration * @{ @@ -53,4 +39,4 @@ static const timer_conf_t timer_config[] = { } /* end extern "C" */ #endif -#endif /* PERIPH_CONF_COMMON_H */ +#endif /* CFG_RTT_DEFAULT_H */ diff --git a/boards/common/nrf51/include/cfg_timer_01.h b/boards/common/nrf51/include/cfg_timer_01.h new file mode 100644 index 0000000000..0377f41061 --- /dev/null +++ b/boards/common/nrf51/include/cfg_timer_01.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2018 Inria + * 2019 Freie Universität Berlin + * + * 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_nrf51 + * @{ + * + * @file + * @brief Shared timer peripheral configuration mapping timers 0 and 1 + * + * @author Alexandre Abadie + * @author Hauke Petersen + */ + +#ifndef CFG_TIMER_01_H +#define CFG_TIMER_01_H + +#include "periph_cpu.h" + +#ifdef __cplusplus + extern "C" { +#endif + +/** + * @name Timer configuration + * @{ + */ +static const timer_conf_t timer_config[] = { + { + .dev = NRF_TIMER0, + .channels = 3, + .bitmode = TIMER_BITMODE_BITMODE_24Bit, + .irqn = TIMER0_IRQn, + }, + { + .dev = NRF_TIMER1, + .channels = 3, + .bitmode = TIMER_BITMODE_BITMODE_16Bit, + .irqn = TIMER1_IRQn, + } +}; + +#define TIMER_0_ISR isr_timer0 +#define TIMER_1_ISR isr_timer1 + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) +/** @} */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +#endif /* CFG_TIMER_01_H */ diff --git a/boards/common/nrf51/include/cfg_timer_012.h b/boards/common/nrf51/include/cfg_timer_012.h new file mode 100644 index 0000000000..cf10da7ac1 --- /dev/null +++ b/boards/common/nrf51/include/cfg_timer_012.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2018 Inria + * 2019 Freie Universität Berlin + * + * 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_nrf51 + * @{ + * + * @file + * @brief Shared timer peripheral configuration mapping timers 0, 1, and 2 + * + * @author Alexandre Abadie + * @author Hauke Petersen + */ + +#ifndef CFG_TIMER_012_H +#define CFG_TIMER_012_H + +#include "periph_cpu.h" + +#ifdef __cplusplus + extern "C" { +#endif + +/** + * @name Timer configuration + * @{ + */ +static const timer_conf_t timer_config[] = { + { + .dev = NRF_TIMER0, + .channels = 3, + .bitmode = TIMER_BITMODE_BITMODE_24Bit, + .irqn = TIMER0_IRQn, + }, + { + .dev = NRF_TIMER1, + .channels = 3, + .bitmode = TIMER_BITMODE_BITMODE_16Bit, + .irqn = TIMER1_IRQn, + }, + { + .dev = NRF_TIMER2, + .channels = 3, + .bitmode = TIMER_BITMODE_BITMODE_16Bit, + .irqn = TIMER2_IRQn, + } +}; + +#define TIMER_0_ISR isr_timer0 +#define TIMER_1_ISR isr_timer1 +#define TIMER_2_ISR isr_timer2 + +#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) +/** @} */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +#endif /* CFG_TIMER_012_H */ diff --git a/boards/microbit/include/periph_conf.h b/boards/microbit/include/periph_conf.h index 8277a4dbbd..9ff4c0da50 100644 --- a/boards/microbit/include/periph_conf.h +++ b/boards/microbit/include/periph_conf.h @@ -21,53 +21,13 @@ #include "periph_cpu.h" #include "cfg_clock_16_0.h" +#include "cfg_timer_012.h" +#include "cfg_rtt_default.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - { - .dev = NRF_TIMER0, - .channels = 3, - .bitmode = TIMER_BITMODE_BITMODE_24Bit, - .irqn = TIMER0_IRQn - }, - { - .dev = NRF_TIMER1, - .channels = 3, - .bitmode = TIMER_BITMODE_BITMODE_16Bit, - .irqn = TIMER1_IRQn - }, - { - .dev = NRF_TIMER2, - .channels = 3, - .bitmode = TIMER_BITMODE_BITMODE_16Bit, - .irqn = TIMER2_IRQn - } -}; - -#define TIMER_0_ISR isr_timer0 -#define TIMER_1_ISR isr_timer1 -#define TIMER_2_ISR isr_timer2 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - -/** - * @name Real time counter configuration - * @{ - */ -#define RTT_NUMOF (1U) -#define RTT_DEV (1) /* NRF_RTC1 */ -#define RTT_MAX_VALUE (0x00ffffff) -#define RTT_FREQUENCY (1024) -/** @} */ - /** * @name UART configuration * @{ diff --git a/boards/nrf51dk/include/periph_conf.h b/boards/nrf51dk/include/periph_conf.h index 8b58aea3ce..3b5b9a9b13 100644 --- a/boards/nrf51dk/include/periph_conf.h +++ b/boards/nrf51dk/include/periph_conf.h @@ -20,8 +20,9 @@ #define PERIPH_CONF_H #include "periph_cpu.h" -#include "periph_conf_common.h" #include "cfg_clock_16_1.h" +#include "cfg_timer_012.h" +#include "cfg_rtt_default.h" #ifdef __cplusplus extern "C" { diff --git a/boards/nrf51dongle/include/periph_conf.h b/boards/nrf51dongle/include/periph_conf.h index 8f15d9dba8..e7ffc5a585 100644 --- a/boards/nrf51dongle/include/periph_conf.h +++ b/boards/nrf51dongle/include/periph_conf.h @@ -20,8 +20,9 @@ #define PERIPH_CONF_H #include "periph_cpu.h" -#include "periph_conf_common.h" #include "cfg_clock_16_1.h" +#include "cfg_timer_012.h" +#include "cfg_rtt_default.h" #ifdef __cplusplus extern "C" { diff --git a/boards/nrf6310/include/periph_conf.h b/boards/nrf6310/include/periph_conf.h index f407434306..a8a766bf2f 100644 --- a/boards/nrf6310/include/periph_conf.h +++ b/boards/nrf6310/include/periph_conf.h @@ -23,8 +23,9 @@ #define PERIPH_CONF_H #include "periph_cpu.h" -#include "periph_conf_common.h" #include "cfg_clock_16_1.h" +#include "cfg_timer_012.h" +#include "cfg_rtt_default.h" #ifdef __cplusplus extern "C" { diff --git a/boards/yunjia-nrf51822/include/periph_conf.h b/boards/yunjia-nrf51822/include/periph_conf.h index 2e7d57563d..df98c44f34 100644 --- a/boards/yunjia-nrf51822/include/periph_conf.h +++ b/boards/yunjia-nrf51822/include/periph_conf.h @@ -20,8 +20,9 @@ #define PERIPH_CONF_H #include "periph_cpu.h" -#include "periph_conf_common.h" #include "cfg_clock_16_0.h" +#include "cfg_timer_012.h" +#include "cfg_rtt_default.h" #ifdef __cplusplus extern "C" {