Fix OCR / PWM calculation (#18094)

Fixes #17968
This commit is contained in:
g3gg0.de 2020-05-26 00:14:15 +02:00 committed by GitHub
parent de89a4b7c1
commit f776260d7a
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23

View file

@ -274,7 +274,7 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255
else else
top = *timer.ICRn; // top = ICRn top = *timer.ICRn; // top = ICRn
_SET_OCRnQ(timer.OCRnQ, timer.q, v * float(top / v_size)); // Scale 8/16-bit v to top value _SET_OCRnQ(timer.OCRnQ, timer.q, v * float(top) / float(v_size)); // Scale 8/16-bit v to top value
} }
} }