STM32CubeMX generation of F1 project prompted to find solutions to the problem of __HAL_TIM_SetCompare

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_SetComparecan not be found.

2. Solution

After the search, the function in the stm32_hal_legacy.hfile:

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."

Published 256 original articles · won praise 654 · views 290 000 +

Guess you like

Origin blog.csdn.net/Mculover666/article/details/104801386