I am using CubeMX to generate code for my NucleoF303. I am a bit confused how to set the pulse width of a timer in PWM mode.
Previously (using an F4) there has been a __HAL_TIM_SetCompare macro in the stm32fxxx_hal_tim.h file.
But that does not exist. Am I supposed to set the duty cycle in some other manner?
Of course I can just directly set the CCRx registers. That works. But if I am going to use a HAL with lots of abstraction like cube seems to be, I would at least like to know how they intend me to use it. Even if I don't.
Not really any code to go with this question.. But here is my current commit in case it is useful:
https://github.com/c-herring/Sumo2017_NucleoF303/tree/221dc57a305ccd64a4b98726df3cce02720b280b
Cheers!
Best Answer
That was indeed some time ago. I've found a copy of STM32CubeF4 V1.6.0 (released 28-May-2015) lying around in an old project directory, and it already has the following alias definition
Digging even deeper, the description of 1.4.0 says
So, it must be the time when
__HAL_TIM_SetCompare
got deprecated in favor of__HAL_TIM_SET_COMPARE
.You should still get the alias definition though, because all HAL headers include
stm32_hal_legacy.h
.