Skip to content

Commit 901a85a

Browse files
committed
Fix for RTC not allowing matching more than one field on Alarm
#154
1 parent bd6a5c5 commit 901a85a

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

libraries/RTC/src/RTC.cpp

+9-21
Original file line numberDiff line numberDiff line change
@@ -666,27 +666,15 @@ bool RTClock::setAlarmCallback(rtc_cbk_t fnc, RTCTime &t, AlarmMatch &m) {
666666
size_t cpy_size = (sizeof(at.time) <= sizeof(struct tm)) ? sizeof(at.time) : sizeof(struct tm);
667667

668668
memcpy(&at.time, &alrm, cpy_size);
669-
if(m.isMatchingSecond()) {
670-
at.sec_match = true;
671-
}
672-
else if(m.isMatchingMinute()) {
673-
at.min_match = true;
674-
}
675-
else if(m.isMatchingHour() ) {
676-
at.hour_match = true;
677-
}
678-
else if(m.isMatchingDay() ) {
679-
at.mday_match = true;
680-
}
681-
else if(m.isMatchingMonth()) {
682-
at.mon_match = true;
683-
}
684-
else if(m.isMatchingYear()) {
685-
at.year_match = true;
686-
}
687-
else if(m.isMatchingDayOfWeek()) {
688-
at.dayofweek_match = true;
689-
}
669+
670+
at.sec_match = m.isMatchingSecond();
671+
at.min_match = m.isMatchingMinute();
672+
at.hour_match = m.isMatchingHour();
673+
at.mday_match = m.isMatchingDay();
674+
at.mon_match = m.isMatchingMonth();
675+
at.year_match = m.isMatchingYear();
676+
at.dayofweek_match = m.isMatchingDayOfWeek();
677+
690678
if(IRQManager::getInstance().addPeripheral(IRQ_RTC,&rtc_irq_cfg)) {
691679
return setRtcAlarm(at);
692680
}

0 commit comments

Comments
 (0)