Audit timers HAL #1: Refactor timer wakers#529
Audit timers HAL #1: Refactor timer wakers#529kurtjd merged 1 commit intoOpenDevicePartnership:mainfrom
Conversation
|
@kurtjd Yeah, blocking counting down timer is broken due to it being reliant on interrupt. After the interrupt refactoring, it is broken. Another way to do without relying on interrupts would be to set MR0R and MR0S to enable reset + stop on match and then check for TC being reset to 0. |
To clarify, do you mean there was a previous interrupt refactoring that broke it (before this PR) and it never got fixed? Or that my refactoring broke it? It seemed to not work even from Edit: Nevermind, found the background context here: #486. Fixing this would probably be best for a separate PR then. |
Splitting this up into two or three PRs just to make reviewing easier. This first part refactors wakers so we no longer need to index into an array and instead each waker is associated with each peripheral via the
infomethod like other peripherals.The interrupt handler will instead call the binded peripheral's
T::info().wake(...)method with the timer type and channel that generated an interrupt just to be certain that we actually want to wake. This has the benefit of simplifying some of the code as well.Tested via
rt685s-evk/timer.rsexample on hardware (tested counting timer and capturer time by connecting signal to eval board). The blockingwait_us:embassy-imxrt/examples/rt685s-evk/src/bin/timer.rs
Line 39 in a5f5813
doesn't seem to work (it blocks indefinitely) but it also doesn't work just using tip of
main, so seems like it's always been broken?Related: #530