embassy
embassy copied to clipboard
Added support for using variable period PWM timers by updating ARR in stead of CCR.
This is a clone of the waveform_chX functions but instead of settings CCR it sets ARR.
The effect of this is that the waveform will have a variable period and a fixed pulse width.
I guess one could have added this to the existing macro but I felt this was cleaner.
Note 1: Apart from using arr this should be identical to the other method so I guess one could argue that a "super method" could be built or parts of the function could be reused but as this solved my problem and was quick and simple I went with it.
Note 2: I am unsure about the array type. The original waveform method has a u16 but I think it should be dynamic depending on the underlying timer used so it should be 32 bit for 32bit timers and 16 bit for 16 bit timers.
Note 3: The arr is I think "per timer" not "per channel" so it is possible that it might make more sense to use a single function and not one per channel.
So please do let me know if this makes sense and what makes the most sense regarding all the notes.
bender run
@mickem needs one rustfmt fix, but CI should be unstuck now.
Thanks for unsticking, formatting has been fixed...
Any updates on this?