2014-12-02 04:01 PM
Hi everyone,
I'm starting with STM32 so i am running through some examples.I am using HAL since it helps porting codes between different MCUsI am now trying using PWM with the timer. I can't seem to find any function to change the duty of the PWM. What i am doing now is directly accessing the register.Is there any function that changes the comparator value that i am missing?Is the method of using TIMx->CCR1= 100 portable between other boards? This is what i care the most. If i have to sometimes use registers i can live with that.2014-12-03 02:55 AM
You can do:
htim4.Instance->CCR1for timer 4 CC1 register.It's basically the same, but a more ''HALish'' syntax.2014-12-04 02:46 AM
Hi,
The STM32Cube HAL TIM driver offers the following Macros, that can be used to:__HAL_TIM_SetCompare(__HANDLE__, __CHANNEL__, __COMPARE__)
__HAL_TIM_SetAutoreload(__HANDLE__, __AUTORELOAD__)
Regards,
Heisenberg.
2014-12-05 03:23 PM
Thank you. I only searched the .c source file, didn't know i should be searching the .h files.