File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -382,6 +382,21 @@ uint32_t RTCZero::getY2kEpoch()
382382 return (getEpoch () - EPOCH_TIME_OFF);
383383}
384384
385+ void RTCZero::setAlarmEpoch (uint32_t ts)
386+ {
387+ if (_configured) {
388+ if (ts < EPOCH_TIME_OFF) {
389+ ts = EPOCH_TIME_OFF;
390+ }
391+
392+ time_t t = ts;
393+ struct tm * tmp = gmtime (&t);
394+
395+ setAlarmDate (tmp->tm_year - EPOCH_TIME_YEAR_OFF, tmp->tm_mon + 1 , tmp->tm_mday );
396+ setAlarmTime (tmp->tm_hour , tmp->tm_min , tmp->tm_sec );
397+ }
398+ }
399+
385400void RTCZero::setEpoch (uint32_t ts)
386401{
387402 if (_configured) {
Original file line number Diff line number Diff line change @@ -95,6 +95,13 @@ class RTCZero {
9595 uint32_t getY2kEpoch ();
9696 void setEpoch (uint32_t ts);
9797 void setY2kEpoch (uint32_t ts);
98+ void setAlarmEpoch (uint32_t ts);
99+
100+ bool isConfigured () {
101+ _configured = RTC->MODE2 .CTRL .reg & RTC_MODE2_CTRL_ENABLE;
102+ configureClock ();
103+ return _configured;
104+ }
98105
99106private:
100107 bool _configured;
You can’t perform that action at this time.
0 commit comments