-
Notifications
You must be signed in to change notification settings - Fork 838
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
stm32/timer: add bare type-erased timer driver (nogeneric timers part 0) #3041
Conversation
I added DMA support and rebased on top of latest changes to #3031. |
|
The reasons were:
Could you please elaborate on why we shouldn't make this type public? The reason why I exposed it is that for timers, people will need to write their own drivers and handle DMA themselves. For example, I'm using the update DMA in my driver for DShot (a protocol for talking to an ESC, electronic speed controller for brushless motors). Of course, people can use the Also, we already expose everything that
I agree; I went for the PAC structs for the first PR, but I wanted to switch to our own typestate markers in a follow-up PR. In fact, I have that follow-up PR mostly fleshed out, it might be ready this week. It attempts to solve the timer taxonomy problem: how to make sure that a timer driver uses only features supported by the timer peripheral, while making the driver usable with as many timers as possible? My original plan was to merge this PR first and follow it with that "timer taxonomy" PR, but at this point it no longer makes sense; once that PR is ready, I think we should just close this PR. |
Closed in favor of #3123. That PR still exposes |
This PR introduces a bare timer driver
bare::AnyTimer
, which erases the TIMx peripheral type and provides bare access to the timer registers. To support different timer types, it is parameterized in the register type (such asTimGp16
orTimAdv
).This is intended to be an MVP for type-erased timer drivers. While
bare::AnyTimer
can already be useful on its own to applications that need just register-level access to the timers, it is also intended to be used as a basic building block for removing generics from higher-level timer drivers in Embassy.Marked as draft because it depends on #3031 and because I also plan to add DMA support into the PR.