Skip to content

zephyr: sys: Create Timer #42

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

Merged
merged 3 commits into from
Dec 18, 2024
Merged

zephyr: sys: Create Timer #42

merged 3 commits into from
Dec 18, 2024

Conversation

d3zd3z
Copy link
Collaborator

@d3zd3z d3zd3z commented Dec 12, 2024

Add a set of wrappers for Zephyr's timer. Timers start as StoppedTimer, which can be either dynamic or static (through object). This can then be started either with start_simple or start_callback which will return a SimpleTimer or a CallbackTimer. This can then be turned back into stopped timers with a stop method.

Copy link
Member

@cfriedt cfriedt left a comment

Choose a reason for hiding this comment

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

LGTM - in the test, I originally mistook 'simples' for 'samples' and thought it was a typo. Naming things is hard 🤷🏼‍♂️

Copy link
Member

@Ablu Ablu left a comment

Choose a reason for hiding this comment

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

Looks good overall, just some minor comments. Going approve regardless.

I think some of the intermediate commits look like they could be squashed? They just read like minor followups of the main commits.

@d3zd3z
Copy link
Collaborator Author

d3zd3z commented Dec 18, 2024

I think some of the intermediate commits look like they could be squashed? They just read like minor followups of the main commits.

So, I'm not sure the right answer here. When commits are amended, github basically discards the history and it is really hard to tell what was changed, so I tend to add more commits. For new code like this, it probably makes sense to squash the history down after the reviews are done.

I'll fix the things you mention, which are pretty minor, and then simplify the history..

Avoid generating build warnings about things that look like links in
bindgen copied rustdocs.

The larger problem is that these are in a different syntax than rustdoc
comments, and will not be formatted nicely.

Signed-off-by: David Brown <[email protected]>
Add a set of wrappers for Zephyr's timer.  Timers start as
`StoppedTimer`, which can be either dynamic or static (through object).
This can then be started either with `start_simple` or `start_callback`
which will return a `SimpleTimer` or a `CallbackTimer`.  This can then
be turned back into stopped timers with a `stop` method.

Signed-off-by: David Brown <[email protected]>
Create a test to exercise the zephyr::timer timers.  This uses both
SimpleTimer and CallbackTimer intensely for 5 seconds and prints out the
results.

Signed-off-by: David Brown <[email protected]>
@d3zd3z d3zd3z merged commit eda3a85 into main Dec 18, 2024
3 checks passed
@d3zd3z d3zd3z deleted the timer branch December 18, 2024 17:17
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.

3 participants