From 3f5a507aac9d994388b5da0eb03f9aab71914a58 Mon Sep 17 00:00:00 2001 From: Louis Bertrand Date: Sun, 15 Oct 2023 05:27:30 -0400 Subject: [PATCH 1/2] Backport RTC getVoltLow from M5Unified --- src/RTC.cpp | 4 ++++ src/RTC.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/RTC.cpp b/src/RTC.cpp index ad97c140..69b607dc 100644 --- a/src/RTC.cpp +++ b/src/RTC.cpp @@ -24,6 +24,10 @@ uint8_t RTC::ReadReg(uint8_t reg) { return Wire1.read(); } +bool RTC::getVoltLow(void) { + return readReg(0x02) & 0x80; // RTCC_VLSEC_MASK +} + void RTC::GetBm8563Time(void) { Wire1.beginTransmission(0x51); Wire1.write(0x02); diff --git a/src/RTC.h b/src/RTC.h index 23653d7f..19266abf 100644 --- a/src/RTC.h +++ b/src/RTC.h @@ -23,6 +23,8 @@ class RTC { void begin(void); void GetBm8563Time(void); + bool getVoltLow(void); + int SetTime(RTC_TimeTypeDef* RTC_TimeStruct); int SetDate(RTC_DateTypeDef* RTC_DateStruct); From 86267862be5bd3c3f13c80a8787aac1d747ed1e6 Mon Sep 17 00:00:00 2001 From: Tinyu Date: Fri, 28 Jun 2024 17:17:02 +0800 Subject: [PATCH 2/2] Update RTC.cpp --- src/RTC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RTC.cpp b/src/RTC.cpp index 850131fb..b421caac 100644 --- a/src/RTC.cpp +++ b/src/RTC.cpp @@ -26,7 +26,7 @@ uint8_t RTC::ReadReg(uint8_t reg) { } bool RTC::getVoltLow(void) { - return readReg(0x02) & 0x80; // RTCC_VLSEC_MASK + return (readReg(0x02) & 0x80) >> 7; // RTCC_VLSEC_MASK } void RTC::GetBm8563Time(void) {