From 901a85aec054458c31b85180b904344dba8193d7 Mon Sep 17 00:00:00 2001 From: maidnl Date: Mon, 2 Oct 2023 12:16:31 +0200 Subject: [PATCH] Fix for RTC not allowing matching more than one field on Alarm https://github.com/arduino/ArduinoCore-renesas/issues/154 --- libraries/RTC/src/RTC.cpp | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/libraries/RTC/src/RTC.cpp b/libraries/RTC/src/RTC.cpp index 94a80bb5..92e8c5aa 100644 --- a/libraries/RTC/src/RTC.cpp +++ b/libraries/RTC/src/RTC.cpp @@ -666,27 +666,15 @@ bool RTClock::setAlarmCallback(rtc_cbk_t fnc, RTCTime &t, AlarmMatch &m) { size_t cpy_size = (sizeof(at.time) <= sizeof(struct tm)) ? sizeof(at.time) : sizeof(struct tm); memcpy(&at.time, &alrm, cpy_size); - if(m.isMatchingSecond()) { - at.sec_match = true; - } - else if(m.isMatchingMinute()) { - at.min_match = true; - } - else if(m.isMatchingHour() ) { - at.hour_match = true; - } - else if(m.isMatchingDay() ) { - at.mday_match = true; - } - else if(m.isMatchingMonth()) { - at.mon_match = true; - } - else if(m.isMatchingYear()) { - at.year_match = true; - } - else if(m.isMatchingDayOfWeek()) { - at.dayofweek_match = true; - } + + at.sec_match = m.isMatchingSecond(); + at.min_match = m.isMatchingMinute(); + at.hour_match = m.isMatchingHour(); + at.mday_match = m.isMatchingDay(); + at.mon_match = m.isMatchingMonth(); + at.year_match = m.isMatchingYear(); + at.dayofweek_match = m.isMatchingDayOfWeek(); + if(IRQManager::getInstance().addPeripheral(IRQ_RTC,&rtc_irq_cfg)) { return setRtcAlarm(at); }