Description
At the moment, all embassy-time
drivers in stm32 are 16-bit, even when used on 32-bit timers like TIM2
. It would be good to support 32-bit mode timers, to allow for less "interrupt spam" when using higher timer precisions like 1MHz.
This would require adding a third impl (right now there is "normal 16-bit" and "low power"), that would only be available when using some timer that happens to be 32-bit.
From @Dirbaio in chat:
so it might be better to make it driven by the metapac metadata
same logic that currently decides whether a timer implements the 32bit or 16bit traits
https://github.com/embassy-rs/embassy/blob/main/embassy-stm32/src/timer/mod.rs#L644-L674
perhaps you can make build.rs look at the metadata to see if the chosen timer's regs are TIM_GP32, and set a time_driver_32bit cfg or something
look at the metadata to see if the chosen timer's regs are TIM_GP32, and set a time_driver_32bit cfg or something
i'd make it automatic on the chosen timer, not let the user choose 32bit/16bit.
if a 32bit timer is chosen then use 32bit. there's no point in using a 32bit timer as 16bit only.
Assigning myself as I might take a crack at this, as I have a project that uses the 1MHz precision, and might benefit from this.