From 7543e714c15891aeca6588efc8700358af3d0d9c Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 7 Aug 2020 13:19:16 +0200 Subject: [PATCH] drivers/periph_common: RTC: move RIOT_EPOCH to header, document it. --- drivers/include/periph/rtc.h | 12 ++++++++++++ drivers/periph_common/rtc.c | 4 ---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/include/periph/rtc.h b/drivers/include/periph/rtc.h index 4885996be9..5c21822ce1 100644 --- a/drivers/include/periph/rtc.h +++ b/drivers/include/periph/rtc.h @@ -46,6 +46,18 @@ extern "C" { #endif +#if !defined(RIOT_EPOCH) || DOXYGEN +/** + * @brief Earliest year of the RTC + * + * 01.01.$RIOT_EPOCH will be the reset value of the RTC if supported. + * + * Internal RTC helper functions such as @see rtc_mktime and @see rtc_localtime + * will not work on dates earlier than that. + */ +#define RIOT_EPOCH (2020) +#endif + /** * @brief Signature for alarm Callback * diff --git a/drivers/periph_common/rtc.c b/drivers/periph_common/rtc.c index 3968c3aec8..e12dce5d94 100644 --- a/drivers/periph_common/rtc.c +++ b/drivers/periph_common/rtc.c @@ -31,10 +31,6 @@ #define HOUR (60U * MINUTE) #define DAY (24U * HOUR) -#ifndef RIOT_EPOCH -#define RIOT_EPOCH (2020) -#endif - /* * The rules here are (to be checked in that explicit order): * 1. If the year is not a multiple of four, it is not a leap year.