Skip to content
Snippets Groups Projects
Commit 6d1aa4ca authored by Karl Schwabe's avatar Karl Schwabe Committed by David Sidrane
Browse files

Bugfix: corrects the ARR calculation for the LED PWM timer

The calculation of the ARR on the LED PWM timer did not subtract 1
from the timer period calculation to get the ARR value.
parent 8f7e2158
No related branches found
No related tags found
No related merge requests found
......@@ -147,14 +147,14 @@ static void led_pwm_timer_init_timer(unsigned timer)
/* If the timer clock source provided as clock_freq is the STM32_APBx_TIMx_CLKIN
* then configure the timer to free-run at 1MHz.
* Otherwize, other frequencies are attainable by adjusting .clock_freq accordingly.
* Otherwise, other frequencies are attainable by adjusting .clock_freq accordingly.
*/
rPSC(timer) = (led_pwm_timers[timer].clock_freq / 1000000) - 1;
/* configure the timer to update at the desired rate */
rARR(timer) = 1000000 / LED_PWM_RATE;
rARR(timer) = (1000000 / LED_PWM_RATE) - 1;
/* generate an update event; reloads the counter and all registers */
rEGR(timer) = GTIM_EGR_UG;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment