Change TMR1 CH1 frequency and duty cycle on the fly
Hi,
I am using a STM32L452RET6 and need to change the PWM frequency (and later the duty cycle) of Timer1 Channel 1 multiple times and on the fly. I tried using the following code but does not change the frequency:
htim1.Init.Period = 20000;
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1); //
Could someone please help with the following:
1) which registers do I need to change for frequency and which for duty cycle?
2) is that htim1.Init.Period = 20000; the correct way to change the frequency or do I need to call a dedicated function?
3) if that is the correct way, is there an additional HAL function I need to call to "load" that new value?
Thank you :)
