-
Notifications
You must be signed in to change notification settings - Fork 214
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
[1/3] Timer refactor: system timer #2576
Conversation
I welcome the simplification here especially since we are encouraging users to just use the higher-level timers and use the hw-timers to back them I don't think users did anything but use Not sure if even the now unsafe functionality is useful, but it probably doesn't hurt to have it (while it would hurt to use it wrong - that's why it's unsafe) |
Unrelated but I think the |
Another question I'm not sure about, should Alarm's be ZSTs? I.e I erased the alarm number to simplify AnyTimer, but maybe that was a step too far for a "dumb timer"? |
The goal is simplicity right? ZSTs add more type complexity, which goes against that. |
a922002
to
ba41b9c
Compare
Skip changelog for embassy and esp-wifi changes, whilst technically breaking, they're both tied to esp-hal releases so it won't be breaking when they upgrade |
f787bc3
to
665ce9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few very nitpicky comments which you can feel free to ignore, but otherwise LGTM
* Removes _all_ type params on Alarm * Systimer no longer implements peripheral ref, the peripheral ref pattern is instead intended to be used on the higher level timer drivers * Removed `Unit` as a type, in favour of an enum * Alarms are back in the main `SystemTimer` "driver" * Made all `Unit` modification methods unsafe, it's not possible to modify the `Unit`'s safely whilst timers and or the `time::now` API is in use
665ce9e
to
74a9264
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Thank you for your contribution!
We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:
Submission Checklist 📝
cargo xtask fmt-packages
command to ensure that all changed code is formatted correctly.CHANGELOG.md
in the proper section.Extra:
Pull Request Details 📖
Description
A fairly radical change, but I realized that it's basically impossible to treat the
Unit
's as a resource and allow users to actually make modifications (FrozenUnit
prevented this before).Unit
operations now go through theSystemTimer
struct, and are all unsafe with safety comments explaining to the user how to use it correctly. Opening early for feedback before I update all the examples.TL;DR:
pattern is instead intended to be used on the higher level timer
drivers (OneShot, Periodic)
Unit
as a type, in favour of an enumSystemTimer
"driver"Unit
modification methods unsafe, it's not possible tomodify the
Unit
's safely whilst timers and or thetime::now
API isin use