Skip to content

embassy-rp (rp2040): Rtc wait_for_alarm #4216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

1-rafael-1
Copy link
Contributor

@1-rafael-1 1-rafael-1 commented May 16, 2025

This PR adds the ability to wait for an RTC alarm.

Reviewer note:

  • !!!Breaking change!!! due to the fact that Rtc struct new() fn now expects Irqs
  • Implementation of binding interupt and handling waker inspired from adc.rs, this is my first time doing this, so I hope I got it reasonably right.
  • I feel like I cheated because I used a flag to mark that we had an interrupt occur - i found no good documentation ad no good place in the Rtc registers to read the same fact from there, and a bunch of tests with that got me nowhere. In case this was rather unenlightened... let me know please!
  • AI was used for syntax help and to answer my 100 questions on what stuff like compiler_fence does and how interrupts, wakers, ... work. Or in other words: Newbie mistakes are not unlikely.

I tested on a Pico board with the provided new example, so this works:

  • wait_for_alarm no matter if one is yet scheduled yet or not
  • alarm_scheduled can determine if we have an alarm sceduled or not and if we have we get the DateTimeFilter out of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants