Skip to content

Add RTC time setting and getting functionality #23

Description

@geoffreyottoy

Not really an issues, more of a request. I think it would be handy if we could access the underlying RTC to keep track of the time that has elapsed between e.g. two pin-interrupt wake's.

I propose two methods to achieve this:

void ArduinoLowPowerClass::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 ArduinoLowPowerClass::getRtcTime(void){
	return rtc.getEpoch();
}

I have tested this on SAMD and it seems to be working.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions