From 2604971753937fabd913e17c25d6976905e4f215 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 23 Apr 2020 18:58:11 +0200 Subject: [PATCH 1/2] drivers/periph/rtt.h: ensure RTT_MAX_VALUE is set --- drivers/include/periph/rtt.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/include/periph/rtt.h b/drivers/include/periph/rtt.h index 475137cd23..b94e6c4b12 100644 --- a/drivers/include/periph/rtt.h +++ b/drivers/include/periph/rtt.h @@ -43,15 +43,22 @@ extern "C" { #endif #ifndef RTT_FREQUENCY - /* Allow mock-RTT for unit tests */ #ifdef MOCK_RTT_FREQUENCY #define RTT_FREQUENCY MOCK_RTT_FREQUENCY +#else +#warning "RTT_FREQUENCY undefined. Set RTT_FREQUENCY to the number of ticks " \ + "per second for the current architecture." +#endif +#endif + +#ifndef RTT_MAX_VALUE +/* Allow mock-RTT for unit tests */ +#ifdef MOCK_RTT_MAX_VALUE #define RTT_MAX_VALUE MOCK_RTT_MAX_VALUE #else - -#warning "RTT_FREQUENCY undefined. Set RTT_FREQUENCY to the number of ticks" \ - "per second for the current architecture." +#warning "RTT_MAX_VALUE is undefined. Set RTT_MAX_VALUE to the maximum value " \ + "for the RTT counter, ensure it is (2^n - 1)." #endif #endif From 0c0f8ec98ff012b842c90e222e1b5c90e158663a Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 23 Apr 2020 19:01:36 +0200 Subject: [PATCH 2/2] drivers/periph/rtt.h: add RTT_FREQUENCY & RTT_MAX_VALUE doc --- drivers/include/periph/rtt.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/include/periph/rtt.h b/drivers/include/periph/rtt.h index b94e6c4b12..b725f78265 100644 --- a/drivers/include/periph/rtt.h +++ b/drivers/include/periph/rtt.h @@ -42,6 +42,25 @@ extern "C" { #endif +/** + * @def RTT_FREQUENCY + * + * @brief The desired frequency for the RTT + */ +#ifdef DOXYGEN +#define RTT_FREQUENCY +#endif + +/** + * @def RTT_MAX_VALUE + * + * @brief The maximum value for the RTT counter, must be (2^n - 1) + * + */ +#ifdef DOXYGEN +#define RTT_MAX_VALUE +#endif + #ifndef RTT_FREQUENCY /* Allow mock-RTT for unit tests */ #ifdef MOCK_RTT_FREQUENCY