In
|
periodUs = period_ticks / (clock_frequency/1000000); |
there's some maths with
period_ticks and another integer constant value, for period_ticks of 20 this will result in (
float)
periodUs being set to 1.0 rather than 1.25
periodUs = period_ticks / (clock_frequency/1000000);
I suspect that should be something like
periodUs = (float)period_ticks / (clock_frequency/1000000);
to force FP maths?
The actual PWM hardware timers are set using period_ticks so they are okay AFAICS.