Skip to content

Commit b7912da

Browse files
authored
Merge pull request #156 from maidnl/fix_rtc_issue_cb_not_allowing_more_fields
Fix for RTC not allowing matching more than one field on Alarm
2 parents b82e642 + 901a85a commit b7912da

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

Diff for: libraries/RTC/src/RTC.cpp

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

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

0 commit comments

Comments
 (0)