2020-01-16 09:55 AM
I'm thinking in particular about defines to influence the HAL library code e.g. USE_HAL_TIM_REGISTER_CALLBACKS.
Adding user defines in MX just puts them in main.h and they are not seen by the library code.
2020-06-30 04:19 AM
There is an hacky ingenious but convoluted suggestion on how to set those defines here: https://community.st.com/s/question/0D50X0000ArRvt6/stmcubeide-usehalregistercallbacks-definition
It seems that CubeMX does not officially support enabling the USE_HAL_*_REGISTER_CALLBACKS options. Can anyone confirm this?
2020-06-30 04:30 AM
As HAL files are supposedly read-only and version volatile, I would look for a compiler option. Most decent SW tools provide in project settings the possibility to add global compiler options. This would probably be the way to activate/deactivate REGISTER_CALLBACKS (which to me seems defeating the interrupt routines to be snappy as it causes a switch/case execution). The other way (probably not allowed) would be to have a global user.h file included to all files (including ST source files) which enables same mechanism without being toolchain dependent. (the CMAKE way?)