Skip to content

Add RTC alarm setter without callback #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion libraries/RTC/src/RTC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,11 @@ bool RTClock::setAlarmCallback(rtc_cbk_t fnc, RTCTime &t, AlarmMatch &m) {

if(is_initialized) {
onRtcInterrupt();
setRtcAlarmClbk(fnc);

if(fnc != nullptr) {
setRtcAlarmClbk(fnc);
}

rtc_alarm_time_t at;
at.min_match = false;
at.sec_match = false;
Expand Down Expand Up @@ -684,6 +688,10 @@ bool RTClock::setAlarmCallback(rtc_cbk_t fnc, RTCTime &t, AlarmMatch &m) {
return false;
}

bool RTClock::setAlarm(RTCTime &t, AlarmMatch &m) {
return this->setAlarmCallback(nullptr, t, m);
}

bool RTClock::isRunning() {
return isRtcRunning();
}
Expand Down
2 changes: 2 additions & 0 deletions libraries/RTC/src/RTC.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ class RTClock {

bool setPeriodicCallback(rtc_cbk_t fnc, Period p);
bool setAlarmCallback(rtc_cbk_t fnc, RTCTime &t, AlarmMatch &m);
bool setAlarm(RTCTime &t, AlarmMatch &m);

bool isRunning();
bool setTime(RTCTime &t);
bool setTimeIfNotRunning(RTCTime &t);
Expand Down
Loading