Bugfix: corrects the ARR calculation for the PWM timer

The calculation of the ARR on the PWM timer did not subtract 1
from the timer period calculation to get the ARR value.
This commit is contained in:
Karl Schwabe
2017-09-13 08:25:06 -10:00
committed by David Sidrane
parent 919b3a218a
commit 38a4c1e90b
+1 -1
View File
@@ -457,7 +457,7 @@ static int timer_set_rate(unsigned timer, unsigned rate)
{
/* configure the timer to update at the desired rate */
rARR(timer) = BOARD_PWM_FREQ / rate;
rARR(timer) = (BOARD_PWM_FREQ / rate) - 1;
/* generate an update event; reloads the counter and all registers */
rEGR(timer) = GTIM_EGR_UG;