Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 7 months ago.
Question about void HAL_TIM_Encoder_MspInit()
I'm a bit confused as to how this code is called.
My understanding is that the HAL_TIM_ENCODER_MspInit() function in the mbed header gets overridden but I don't see the "EncoderMspInitFX.cpp" file being included anywhere so how does the compiler know where to look for it?
Question relating to:
1 Answer
9 years, 7 months ago.
You never include .cpp files in your code like you do .h files. The compiler needs to be setup which files to include/where to look for those files. The online compiler simply includes all user files in its compilation. So in the program you link there are three cpp files for that function, with #ifdef guards to make sure only the correct one is actually compiled.