1. Problem Description
After generating STM32F103C8T6 the MDK engineering STM32CubeMX, changes the duty cycle timer count value in main.c in time, given:
Anyway, HAL API library internal function __HAL_TIM_SetCompare
can not be found.
2. Solution
After the search, the function in the stm32_hal_legacy.h
file:
So certainly the wrong reasons: This function is called when the first document did not include it , look for the file name again:
Sure enough, it includes this header file needs to be defined macrosUSE_HAL_LEGACY
.
In front of it define it:
Recompile, successfully resolved the problem!
After such additions, re-use STM32CubeMX generation project, the code will be overwritten automatically, need to add!
Receive more exciting articles and resources push, welcome to subscribe to my micro-channel public number: "mculover666."