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()
382
382
return (getEpoch () - EPOCH_TIME_OFF);
383
383
}
384
384
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
+
385
400
void RTCZero::setEpoch (uint32_t ts)
386
401
{
387
402
if (_configured) {
Original file line number Diff line number Diff line change @@ -95,6 +95,13 @@ class RTCZero {
95
95
uint32_t getY2kEpoch ();
96
96
void setEpoch (uint32_t ts);
97
97
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
+ }
98
105
99
106
private:
100
107
bool _configured;
You can’t perform that action at this time.
0 commit comments