drivers: mcpwm: esp32: Fix duty rounding
Duty value in the driver is calculated from timer cycles, which
can introduce precision loss when converting from pwm_set() to
pwm_set_cycles(). To avoid truncating values with a fractional
part ≥ 0.5 and further drifting the effective duty, round the
computed duty to the nearest integer.
Signed-off-by:
Raffael Rostagno <raffael.rostagno@espressif.com>
Loading
Please sign in to comment