2022-11-11 05:52 AM
Hello,
I was creating a new project for STM32WL in STM32CubeMX today, and I wanted to use the "register callbacks" functionality for a timer peripheral. So I have enabled the callback feature and generated the project. When I opened it the symbols for callbacks were not defined. I started digging around and found out that the symbol **USE_HAL_TIM_REGISTER_CALLBACKS** was set to value **1** in the *stm32wlxx_hal_conf.h*. But this header is not included in the *stm32wlxx_hal_tim.h* so callbacks enumeration is not created. The *stm32wlxx_hal_tim.c* is including the *stm32wlxx_hal.h* so the register/unregister functions are created correctly.
Am I missing something? How the HAL driver can work if the structure defined in the header file does not contain callbacks definitions?
Sorry if someone already asked, but I couldn't find any topic that addresses this.
Best regards,
Tomas.
Solved! Go to Solution.
2022-11-11 07:01 AM
stm32wlxx_hal_tim.c includes stm32wlxx_hal.h:
which includes stm32wlxx_hal_conf.h:
which includes your definitions, including USE_HAL_TIM_REGISTER_CALLBACKS.
You are possibly assuming that stm32wlxx_hal_tim.c includes stm32wlxx_hal_tim.h directly, which is not the case.
2022-11-11 07:01 AM
stm32wlxx_hal_tim.c includes stm32wlxx_hal.h:
which includes stm32wlxx_hal_conf.h:
which includes your definitions, including USE_HAL_TIM_REGISTER_CALLBACKS.
You are possibly assuming that stm32wlxx_hal_tim.c includes stm32wlxx_hal_tim.h directly, which is not the case.
2022-11-11 07:14 AM
Damn sorry for the stupid question. I was misled by my IDE which complained about the unknown symbol(s), but everything is included correctly (the compiler can resolve all symbols after all).