Closed michaelbeaumont closed 3 years ago
Thanks! This looks reasonable to me, but could you add documentation to the trait and its methods?
(Also, we should really set up a CHANGELOG. I think I'll open a PR with a suggestion.)
Done, let me know if that's sufficient. I think the trait is sort of only internally used at the moment, so there's not much to say about them. I added changelog entries as well.
Thanks!
Useful for initializing a
Timer
to callstart()
on later.I suppose
timer()
creates it and starts it as a sort of convenience, but it's a little silly having to pass a dummy timeout. More seriously, callingtimer()
with a dummy timeout but withoutlisten()
and later callinglisten()
andstart()
can cause a subtle issue, I believe. If the dummy timeout has already overflowed, the interrupt is already pending and will immediately fire, before the newstart
has expired (necessitating aclear_irq()
call in addition tolisten
andstart
).This PR doesn't fix that issue per se, it only avoids it for creation but I think the expected behavior for
start()
would be that it also callsclear_irq
, WDYT?This is a breaking change for the
GeneralPurposeTimer
trait but it feels reasonable, though we could also add an additional trait to holdenable
.