From f41b43e2634e895e2ef2db5bdd0b621d0940adf6 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Wed, 17 Jun 2020 12:40:13 +0200 Subject: [PATCH] cpu/saml21: add unified rtt configuration --- boards/saml21-xpro/include/periph_conf.h | 3 ++- boards/samr30-xpro/include/periph_conf.h | 6 ++++-- boards/samr34-xpro/include/periph_conf.h | 5 +++-- cpu/saml21/include/periph_cpu.h | 10 ++++++++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/boards/saml21-xpro/include/periph_conf.h b/boards/saml21-xpro/include/periph_conf.h index 95a6fe7420..05575a275d 100644 --- a/boards/saml21-xpro/include/periph_conf.h +++ b/boards/saml21-xpro/include/periph_conf.h @@ -162,8 +162,9 @@ static const i2c_conf_t i2c_config[] = { * @name RTT configuration * @{ */ +#ifndef RTT_FREQUENCY #define RTT_FREQUENCY (32768U) -#define RTT_MAX_VALUE (0xffffffffU) +#endif /** @} */ /** diff --git a/boards/samr30-xpro/include/periph_conf.h b/boards/samr30-xpro/include/periph_conf.h index d10bc71771..a64d0114cf 100644 --- a/boards/samr30-xpro/include/periph_conf.h +++ b/boards/samr30-xpro/include/periph_conf.h @@ -153,10 +153,12 @@ static const i2c_conf_t i2c_config[] = { * @name RTT configuration * @{ */ -#define RTT_FREQUENCY (32768U) -#define RTT_MAX_VALUE (0xffffffffU) +#ifndef RTT_FREQUENCY +#define RTT_FREQUENCY (32768U) +#endif /** @} */ + /** * @name ADC Configuration * @{ diff --git a/boards/samr34-xpro/include/periph_conf.h b/boards/samr34-xpro/include/periph_conf.h index 2489d7b0be..3a3ad94f3b 100644 --- a/boards/samr34-xpro/include/periph_conf.h +++ b/boards/samr34-xpro/include/periph_conf.h @@ -144,8 +144,9 @@ static const i2c_conf_t i2c_config[] = { * @name RTT configuration * @{ */ -#define RTT_FREQUENCY (32768U) -#define RTT_MAX_VALUE (0xffffffffU) +#ifndef RTT_FREQUENCY +#define RTT_FREQUENCY (32768U) +#endif /** @} */ /** diff --git a/cpu/saml21/include/periph_cpu.h b/cpu/saml21/include/periph_cpu.h index d7f0345026..cd08216811 100644 --- a/cpu/saml21/include/periph_cpu.h +++ b/cpu/saml21/include/periph_cpu.h @@ -73,6 +73,16 @@ typedef enum { */ #define DAC_NUMOF (2) +/** + * @name Real time counter configuration + * @{ + */ +#define RTT_MAX_VALUE (0xffffffff) +#define RTT_CLOCK_FREQUENCY (32768U) /* in Hz */ +#define RTT_MIN_FREQUENCY (RTT_CLOCK_FREQUENCY / 512U) /* in Hz */ +#define RTT_MAX_FREQUENCY (RTT_CLOCK_FREQUENCY) /* in Hz */ +/** @} */ + #ifdef __cplusplus } #endif