-
Notifications
You must be signed in to change notification settings - Fork 213
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
System time based on static systick isr counter #149
base: master
Are you sure you want to change the base?
Conversation
src/systick.rs
Outdated
// there can only be one! | ||
#[exception] | ||
fn SysTick() { | ||
free(|_|unsafe { | ||
if let Some(systime) = &mut SYSTIME { | ||
systime.systick += 1; | ||
} | ||
}); | ||
} |
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.
That is going to be an issue. We really shouldn't make any assumptions about the runtime here.
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.
So is it possible to wrap an interrupt without making assumptions about the ruintime?
I mean something better than adding a global fn SystickISR() {..}
, which has to be called from the implementation isr.
9ca6671
to
f34a2aa
Compare
Maybe this could just be an example without changes to the hal? |
That is definitely possible. I was actually thinking about implementing a general "tick" counter crate a while back; something that you would initialise and then feed with monotonic counter updates which could be used for all kinds of purposes, e.g. a delay implementation. |
9ad31f9
to
c4b7312
Compare
I added this to the hal while playing with it. Maybe it fits the upstream :)