From 2aad103497461df1d2e063aaf989605bb14c0be1 Mon Sep 17 00:00:00 2001 From: Naguissa Date: Thu, 11 Jun 2020 13:35:28 +0200 Subject: [PATCH] 6.2.10: weekdays defines --- library.properties | 2 +- src/uRTCLib.cpp | 16 +++++++++++++++- src/uRTCLib.h | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/library.properties b/library.properties index bf73bcc..40d2f49 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=uRTCLib -version=6.2.9 +version=6.2.10 author=Naguissa maintainer=Naguissa sentence=Really tiny library to basic RTC functionality on Arduino. DS1307, DS3231 and DS3232 RTCs are supported. See https://github.com/Naguissa/uEEPROMLib for EEPROM support. Temperature, Alarms, SQWG, Power lost and RAM support. diff --git a/src/uRTCLib.cpp b/src/uRTCLib.cpp index 92cb203..c367f7f 100644 --- a/src/uRTCLib.cpp +++ b/src/uRTCLib.cpp @@ -21,7 +21,7 @@ * @see https://www.foroelectro.net/librerias-arduino-ide-f29/rtclib-arduino-libreria-simple-y-eficaz-para-rtc-y-t95.html * @see naguissa@foroelectro.net * @see See uEEPROMLib for EEPROM support. - * @version 6.2.9 + * @version 6.2.10 */ #include @@ -411,6 +411,13 @@ uint8_t uRTCLib::year() { * \brief Returns actual Day Of Week * * @return Current stored Day Of Week + * - #URTCLIB_WEEKDAY_SUNDAY + * - #URTCLIB_WEEKDAY_MONDAY + * - #URTCLIB_WEEKDAY_TUESDAY + * - #URTCLIB_WEEKDAY_WEDNESDAY + * - #URTCLIB_WEEKDAY_THURSDAY + * - #URTCLIB_WEEKDAY_FRIDAY + * - #URTCLIB_WEEKDAY_SATURDAY */ uint8_t uRTCLib::dayOfWeek() { return _dayOfWeek; @@ -458,6 +465,13 @@ uint8_t uRTCLib::model() { * @param minute minute to set to HW RTC * @param hour hour to set to HW RTC * @param dayOfWeek day of week to set to HW RTC + * - #URTCLIB_WEEKDAY_SUNDAY + * - #URTCLIB_WEEKDAY_MONDAY + * - #URTCLIB_WEEKDAY_TUESDAY + * - #URTCLIB_WEEKDAY_WEDNESDAY + * - #URTCLIB_WEEKDAY_THURSDAY + * - #URTCLIB_WEEKDAY_FRIDAY + * - #URTCLIB_WEEKDAY_SATURDAY * @param dayOfMonth day of month to set to HW RTC * @param month month to set to HW RTC * @param year year to set to HW RTC in last 2 digits mode. As RTCs only support 19xx and 20xx years (see datasheets), it's harcoded to 20xx. diff --git a/src/uRTCLib.h b/src/uRTCLib.h index e0cf764..53de33f 100644 --- a/src/uRTCLib.h +++ b/src/uRTCLib.h @@ -18,7 +18,7 @@ * @see https://www.foroelectro.net/librerias-arduino-ide-f29/rtclib-arduino-libreria-simple-y-eficaz-para-rtc-y-t95.html * @see naguissa@foroelectro.net * @see See uEEPROMLib for EEPROM support. - * @version 6.2.9 + * @version 6.2.10 */ /** \file uRTCLib.h * \brief uRTCLib header file @@ -38,6 +38,7 @@ */ #define URTCLIB_ADDRESS 0x68 + /************ MODELS ***********/ /** * \brief Model definition, DS1307 */ @@ -52,6 +53,38 @@ #define URTCLIB_MODEL_DS3232 3 + /************ WEEK DAYS ***********/ + /** + * \brief Week day definition, [Sun..Sat] as [1..7]. Sunday + */ + #define URTCLIB_WEEKDAY_SUNDAY 1 + /** + * \brief Week day definition, [Sun..Sat] as [1..7]. Monday + */ + #define URTCLIB_WEEKDAY_MONDAY 2 + /** + * \brief Week day definition, [Sun..Sat] as [1..7]. Tuesday + */ + #define URTCLIB_WEEKDAY_TUESDAY 3 + /** + * \brief Week day definition, [Sun..Sat] as [1..7]. Wednesday + */ + #define URTCLIB_WEEKDAY_WEDNESDAY 4 + /** + * \brief Week day definition, [Sun..Sat] as [1..7]. Thursday + */ + #define URTCLIB_WEEKDAY_THURSDAY 5 + /** + * \brief Week day definition, [Sun..Sat] as [1..7]. Friday + */ + #define URTCLIB_WEEKDAY_FRIDAY 6 + /** + * \brief Week day definition, [Sun..Sat] as [1..7]. Saturday + */ + #define URTCLIB_WEEKDAY_SATURDAY 7 + + + /************ ALARM SELECTION: ***********/ //Note: Not valid for DS1307!