STM32: Add a low_level::Timer::wait_for_update function to timers - #6819
Open
EliteTK wants to merge 1 commit into
Open
STM32: Add a low_level::Timer::wait_for_update function to timers#6819EliteTK wants to merge 1 commit into
low_level::Timer::wait_for_update function to timers#6819EliteTK wants to merge 1 commit into
Conversation
This requires first calling `with_update_interrupt` on a `Timer`, this sets an update interrupt specific `Mode` marker which enables calling `wait_for_update`. This design specifically permits adding other interrupts and related methods in the future.
Contributor
|
I am not sure whether it's a good idea to add mode to the low-level timers. In fact the low-level timers should be type-erased, but that's a big refactor. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a new take on #4630.
I noticed there is now a
modething in embassy-stm32 itself. The way I use it here is not quite how it's used elsewhere. I was trying to avoid a disruptive change to the low level timer constructor and to avoid requiring every user of this to pass every relevant IRQ binding.You call
with_update_interrupton aTimerand this gives you a newTimerwith a slightly different time indicating that the binding was passed. This unlockswait_for_update. The idea is that capture compare and all the other timer specific interrupts could be added this way in the future without disrupting each other.I believe this would eventually make the low-level timer driver powerful enough to implement any of the high level drivers from normal code without necessarily needing direct support from embassy-stm32.
I think this does a good job of addressing some of the comments from the previous PR discussion while staying relatively small as a change.
But I understand that the
with_update_interruptapproach is somewhat unusual here... Interested to hear opinions.