Skip to content

Enable RTC-based Time Alarm functionality#542

Merged
felipebalbi merged 17 commits intoOpenDevicePartnership:mainfrom
Ctru14:connortruono/rtc-alarm
Jan 15, 2026
Merged

Enable RTC-based Time Alarm functionality#542
felipebalbi merged 17 commits intoOpenDevicePartnership:mainfrom
Ctru14:connortruono/rtc-alarm

Conversation

@Ctru14
Copy link
Copy Markdown
Contributor

@Ctru14 Ctru14 commented Jan 13, 2026

Enables access to the RTC alarm registers to provide an interrupt-based time alarm on the RTC peripheral. This allows for a lower power floor as the OsTimer can be shut down for longer periods in favor of an RTC wake.

Added the following to the RTC peripheral:

  • set_alarm() function
  • clear_alarm() function
  • RTC() interrupt handler on match
  • register_alarm_waker() function for use in Future::poll

rtc-alarm.rs demo added to RT685 EVK examples showing the custom RtcAlarm struct/Future needed to implement the alarm based on the consumer's peripheral synchronization

Demo results:

269.753145 [INFO ] RTC set time: Datetime { data: UncheckedDatetime { year: 2026, month: January, day: 12, hour: 16, minute: 0, second: 0, nanosecond: 0 } } (rtc_alarm src/bin/rtc-alarm.rs:56)
269.753381 [INFO ] Current time before alarm: Datetime { data: UncheckedDatetime { year: 2026, month: January, day: 12, hour: 16, minute: 0, second: 0, nanosecond: 0 } } (rtc_alarm src/bin/rtc-alarm.rs:61)
269.753466 [INFO ] Waiting 5 seconds... (rtc_alarm src/bin/rtc-alarm.rs:63)
274.753764 [INFO ] Current time after waiting: Datetime { data: UncheckedDatetime { year: 2026, month: January, day: 12, hour: 16, minute: 0, second: 4, nanosecond: 0 } } (rtc_alarm src/bin/rtc-alarm.rs:66)
274.753879 [INFO ] Setting alarm to trigger in 10 seconds... (rtc_alarm src/bin/rtc-alarm.rs:72)
274.754072 [INFO ] Waiting for alarm... (rtc_alarm src/bin/rtc-alarm.rs:81)
274.754231 [INFO ] Alarm pending at time Datetime { data: UncheckedDatetime { year: 2026, month: January, day: 12, hour: 16, minute: 0, second: 4, nanosecond: 0 } }, expires at 1768233614 (rtc_alarm src/bin/rtc-alarm.rs:26)
283.918927 [INFO ] Alarm triggered! Wake time: Datetime { data: UncheckedDatetime { year: 2026, month: January, day: 12, hour: 16, minute: 0, second: 14, nanosecond: 0 } } (rtc_alarm src/bin/rtc-alarm.rs:86)
283.919091 [INFO ] Alarm cleared (rtc_alarm src/bin/rtc-alarm.rs:90)

Copilot AI review requested due to automatic review settings January 13, 2026 22:59
@Ctru14 Ctru14 requested a review from a team as a code owner January 13, 2026 22:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables RTC alarm functionality to allow interrupt-based time alarms, providing a lower power floor by allowing the OsTimer to be shut down in favor of RTC-based wakeups.

Changes:

  • Added set_alarm() and clear_alarm() methods to RtcDatetimeClock for configuring alarm interrupts
  • Implemented RTC interrupt handler to wake tasks when alarms fire
  • Added example demonstrating the alarm functionality with a custom Future implementation

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/rtc.rs Added alarm functionality including set/clear methods, static waker, and interrupt handler
examples/rt685s-evk/src/bin/rtc-alarm.rs New example demonstrating RTC alarm usage with custom Future implementation
examples/rt685s-evk/README.md Updated documentation to use generic [device] placeholder

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs Outdated
Copilot AI review requested due to automatic review settings January 13, 2026 23:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs Outdated
Copilot AI review requested due to automatic review settings January 13, 2026 23:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rtc.rs
Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs Outdated
Copilot AI review requested due to automatic review settings January 14, 2026 01:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rtc.rs
Comment thread src/rtc.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rtc.rs
Comment thread src/rtc.rs
Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs
williampMSFT
williampMSFT previously approved these changes Jan 14, 2026
Comment thread src/rtc.rs
Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs
Comment thread src/rtc.rs
Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs
Comment thread src/rtc.rs Outdated
Comment thread examples/rt685s-evk/src/bin/rtc-alarm.rs
Copilot AI review requested due to automatic review settings January 14, 2026 22:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs Outdated
Copilot AI review requested due to automatic review settings January 14, 2026 22:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rtc.rs
Comment thread src/rtc.rs
Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs
Copilot AI review requested due to automatic review settings January 14, 2026 23:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rtc.rs Outdated
Comment thread src/rtc.rs Outdated
@Ctru14 Ctru14 closed this Jan 15, 2026
@Ctru14 Ctru14 reopened this Jan 15, 2026
@felipebalbi felipebalbi merged commit fbf7df4 into OpenDevicePartnership:main Jan 15, 2026
22 checks passed
@Ctru14 Ctru14 deleted the connortruono/rtc-alarm branch January 15, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants