Skip to content
Commit 382ce7cb authored by Raffael Rostagno's avatar Raffael Rostagno Committed by Benjamin Cabé
Browse files

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: default avatarRaffael Rostagno <raffael.rostagno@espressif.com>
parent 98b00656
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment