arduino-libraries / ArduinoLowPower

Powersave features for SAMD boards
GNU Lesser General Public License v2.1
80 stars 57 forks source link

Allow access to RTC #31

Closed geoffreyottoy closed 8 months ago

geoffreyottoy commented 3 years ago

This is a great library. Not really an issue, more of a feature request.

Is it possible to add time-keeping via the RTC?

For example:

void setRtcTime(uint32_t time){
    // not sure if this is the best way to make sure the RTC is up and running
    if (!rtc.isConfigured()) {
        attachInterruptWakeup(RTC_ALARM_WAKEUP, NULL, 0);
    }

    rtc.setEpoch(time);
}

uint32_t getRtcTime(void){
    return rtc.getEpoch();
}
kpfleming commented 3 years ago

This appears to be a duplicate of #23.