System time based on static systick isr counter#149
System time based on static systick isr counter#149h2obrain wants to merge 2 commits intostm32-rs:masterfrom
Conversation
| // 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.
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.
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 :)