diff --git a/boards/common/arduino-mkr/include/periph_conf_common.h b/boards/common/arduino-mkr/include/periph_conf_common.h index c5f22f62d9..97cdc606d8 100644 --- a/boards/common/arduino-mkr/include/periph_conf_common.h +++ b/boards/common/arduino-mkr/include/periph_conf_common.h @@ -189,24 +189,13 @@ static const i2c_conf_t i2c_config[] = { #define I2C_NUMOF ARRAY_SIZE(i2c_config) /** @} */ -/** - * @name RTC configuration - * @{ - */ -#define RTC_DEV RTC->MODE2 -/** @} */ - /** * @name RTT configuration * @{ */ -#define RTT_DEV RTC->MODE0 -#define RTT_IRQ RTC_IRQn -#define RTT_IRQ_PRIO 10 -#define RTT_ISR isr_rtc -#define RTT_MAX_VALUE (0xffffffff) +#ifndef RTT_FREQUENCY #define RTT_FREQUENCY (32768U) /* in Hz. For changes see `rtt.c` */ -#define RTT_RUNSTDBY (1) /* Keep RTT running in sleep states */ +#endif /** @} */ /** diff --git a/boards/common/arduino-zero/include/periph_conf.h b/boards/common/arduino-zero/include/periph_conf.h index 1114acadba..1f4610bfb2 100644 --- a/boards/common/arduino-zero/include/periph_conf.h +++ b/boards/common/arduino-zero/include/periph_conf.h @@ -267,24 +267,13 @@ static const i2c_conf_t i2c_config[] = { #define I2C_NUMOF ARRAY_SIZE(i2c_config) /** @} */ -/** - * @name RTC configuration - * @{ - */ -#define RTC_DEV RTC->MODE2 -/** @} */ - /** * @name RTT configuration * @{ */ -#define RTT_DEV RTC->MODE0 -#define RTT_IRQ RTC_IRQn -#define RTT_IRQ_PRIO 10 -#define RTT_ISR isr_rtc -#define RTT_MAX_VALUE (0xffffffff) +#ifndef RTT_FREQUENCY #define RTT_FREQUENCY (32768U) /* in Hz. For changes see `rtt.c` */ -#define RTT_RUNSTDBY (1) /* Keep RTT running in sleep states */ +#endif /** @} */ /** diff --git a/boards/common/sodaq/include/cfg_rtt_default.h b/boards/common/sodaq/include/cfg_rtt_default.h index a73c1a135c..0a6230a7bd 100644 --- a/boards/common/sodaq/include/cfg_rtt_default.h +++ b/boards/common/sodaq/include/cfg_rtt_default.h @@ -32,13 +32,9 @@ extern "C" { * @name RTT configuration * @{ */ -#define RTT_DEV RTC->MODE0 -#define RTT_IRQ RTC_IRQn -#define RTT_IRQ_PRIO 10 -#define RTT_ISR isr_rtc -#define RTT_MAX_VALUE (0xffffffff) +#ifndef RTT_FREQUENCY #define RTT_FREQUENCY (32768U) /* in Hz. For changes see `rtt.c` */ -#define RTT_RUNSTDBY (1) /* Keep RTT running in sleep states */ +#endif /** @} */ #ifdef __cplusplus diff --git a/boards/feather-m0/include/periph_conf.h b/boards/feather-m0/include/periph_conf.h index ce3f6c37b8..9b4dec9af2 100644 --- a/boards/feather-m0/include/periph_conf.h +++ b/boards/feather-m0/include/periph_conf.h @@ -248,23 +248,12 @@ static const i2c_conf_t i2c_config[] = { /** @} */ /** - * @name RTC configuration + * @name RTT configuration * @{ */ -#define RTC_DEV RTC->MODE2 -/** @} */ - -/** - * @name RTT configuration - * @{ - */ -#define RTT_DEV RTC->MODE0 -#define RTT_IRQ RTC_IRQn -#define RTT_IRQ_PRIO 10 -#define RTT_ISR isr_rtc -#define RTT_MAX_VALUE (0xffffffff) +#ifndef RTT_FREQUENCY #define RTT_FREQUENCY (32768U) /* in Hz. For changes see `rtt.c` */ -#define RTT_RUNSTDBY (1) /* Keep RTT running in sleep states */ +#endif /** @} */ /** diff --git a/boards/hamilton/include/periph_conf.h b/boards/hamilton/include/periph_conf.h index 7cfda8f8db..e8b169c14a 100644 --- a/boards/hamilton/include/periph_conf.h +++ b/boards/hamilton/include/periph_conf.h @@ -88,23 +88,12 @@ extern "C" { /** @} */ /** - * @name RTC configuration + * @name RTT configuration * @{ */ -#define RTC_DEV RTC->MODE2 -/** @} */ - -/** - * @name RTT configuration - * @{ - */ -#define RTT_DEV RTC->MODE0 -#define RTT_IRQ RTC_IRQn -#define RTT_IRQ_PRIO 10 -#define RTT_ISR isr_rtc -#define RTT_MAX_VALUE (0xffffffff) +#ifndef RTT_FREQUENCY #define RTT_FREQUENCY (32768U) /* in Hz. For changes see `rtt.c` */ -#define RTT_RUNSTDBY (1) /* Keep RTT running in sleep states */ +#endif /** @} */ /** diff --git a/boards/samd21-xpro/include/periph_conf.h b/boards/samd21-xpro/include/periph_conf.h index 7d451ea421..a6613925ee 100644 --- a/boards/samd21-xpro/include/periph_conf.h +++ b/boards/samd21-xpro/include/periph_conf.h @@ -316,24 +316,13 @@ static const i2c_conf_t i2c_config[] = { #define I2C_NUMOF ARRAY_SIZE(i2c_config) /** @} */ -/** - * @name RTC configuration - * @{ - */ -#define RTC_DEV RTC->MODE2 -/** @} */ - /** * @name RTT configuration * @{ */ -#define RTT_DEV RTC->MODE0 -#define RTT_IRQ RTC_IRQn -#define RTT_IRQ_PRIO 10 -#define RTT_ISR isr_rtc -#define RTT_MAX_VALUE (0xffffffff) +#ifndef RTT_FREQUENCY #define RTT_FREQUENCY (32768U) /* in Hz. For changes see `rtt.c` */ -#define RTT_RUNSTDBY (1) /* Keep RTT running in sleep states */ +#endif /** @} */ /** diff --git a/boards/samr21-xpro/include/periph_conf.h b/boards/samr21-xpro/include/periph_conf.h index 2624d3388f..2c9ab96b4f 100644 --- a/boards/samr21-xpro/include/periph_conf.h +++ b/boards/samr21-xpro/include/periph_conf.h @@ -283,24 +283,13 @@ static const i2c_conf_t i2c_config[] = { /** @} */ /** - * @name RTC configuration + * @name RTT configuration * @{ */ -#define RTC_DEV RTC->MODE2 -/** @} */ - -/** - * @name RTT configuration - * @{ - */ -#define RTT_DEV RTC->MODE0 -#define RTT_IRQ RTC_IRQn -#define RTT_IRQ_PRIO 10 -#define RTT_ISR isr_rtc -#define RTT_MAX_VALUE (0xffffffff) -#define RTT_MIN_OFFSET (10U) +#ifndef RTT_FREQUENCY #define RTT_FREQUENCY (32768U) /* in Hz. For changes see `rtt.c` */ -#define RTT_RUNSTDBY (1) /* Keep RTT running in sleep states */ +#endif +#define RTT_MIN_OFFSET (10U) /** @} */ /** diff --git a/boards/serpente/include/periph_conf.h b/boards/serpente/include/periph_conf.h index 0fc26888d4..832668c558 100644 --- a/boards/serpente/include/periph_conf.h +++ b/boards/serpente/include/periph_conf.h @@ -212,8 +212,9 @@ static const i2c_conf_t i2c_config[] = { * @name RTT configuration * @{ */ -#define RTT_MAX_VALUE (0xffffffff) +#ifndef RTT_FREQUENCY #define RTT_FREQUENCY (32768U) /* in Hz. For changes see `rtt.c` */ +#endif /** @} */ /** diff --git a/cpu/samd21/include/periph_cpu.h b/cpu/samd21/include/periph_cpu.h index aed4f91fab..1018355ed1 100644 --- a/cpu/samd21/include/periph_cpu.h +++ b/cpu/samd21/include/periph_cpu.h @@ -127,6 +127,18 @@ typedef enum { */ #define DAC_NUMOF (1) +/** + * @name Real time counter configuration + * @{ + */ +#define RTT_RUNSTDBY (1) /* Keep RTT running in sleep states */ + +#define RTT_MAX_VALUE (0xffffffff) +#define RTT_CLOCK_FREQUENCY (32768U) /* in Hz */ +#define RTT_MIN_FREQUENCY (RTT_CLOCK_FREQUENCY / 1024U) /* in Hz */ +#define RTT_MAX_FREQUENCY (RTT_CLOCK_FREQUENCY) /* in Hz */ +/** @} */ + #ifdef __cplusplus } #endif