Skip to content

Commit

Permalink
Merge pull request #156 from maidnl/fix_rtc_issue_cb_not_allowing_mor…
Browse files Browse the repository at this point in the history
…e_fields

Fix for RTC not allowing matching more than one field on Alarm
  • Loading branch information
facchinm authored Oct 2, 2023
2 parents b82e642 + 901a85a commit b7912da
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions libraries/RTC/src/RTC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,27 +668,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);
}
Expand Down

0 comments on commit b7912da

Please sign in to comment.