Skip to content
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

Implement embedded_hal_async::delay::DelayUs trait for SYSTIMER alarms #812

Merged
merged 3 commits into from
Sep 25, 2023

Conversation

jessebraham
Copy link
Member

This completes one task of #752. Changes should be pretty straight-forward, though I have renamed some things for consistency as well.

The async functionality requires the Alarm to first be put in Periodic mode, but I don't think is an issue.

There isn't really an example of this, as I don't think it really makes sense, but I did test this locally by modifying the embassy_hello_world example as needed.

pub fn set_period(&self, period: fugit::HertzU32) {
let time_period: MicrosDurationU32 = period.into_duration();
let us = time_period.ticks();
pub fn set_period(&self, period: MicrosDurationU32) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess a duration better matches a time period but just want to make sure we all agree since it's a change in public API

Copy link
Member Author

Choose a reason for hiding this comment

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

I would recommend changing the name otherwise, it was misleading before IMO. Don't really care which units we ultimately accept as arguments but for the given function name this made more sense to me.

Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

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

LGTM - I think changing set_period to duration makes sense - but maybe a second (or third) opinion would be good

Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

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

LGTM, but imo we should use <verb>_<noun> regarding interrupt clearing/setting etc.

@jessebraham
Copy link
Member Author

jessebraham commented Sep 25, 2023

(Sorry, forgot the search in VS Code has weird behavior in workspaces, will fix)

@jessebraham jessebraham merged commit b91b3b1 into esp-rs:main Sep 25, 2023
16 checks passed
@jessebraham jessebraham deleted the feature/async-delay branch September 25, 2023 14:38
}

#[interrupt]
fn SYSTIMER_TARGET0() {
Copy link
Contributor

Choose a reason for hiding this comment

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

@jessebraham This change broke embassy. The interrupt handlers may already be defined by

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.

4 participants