2018-07-08 03:14 AM
Hi,
As we know peripherals can have callback functions such as the below one for the PWM:
void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim) {
}
This is something like a general callback, But if we have several enabled PWMs or ADCs or similar, then how these could be differentiated by the callback functions to be fired just by the one we like, or for the time we like to have several callbacks, one for each. is that possible?
Solved! Go to Solution.
2018-07-08 06:04 AM
The mechanics of the HAL is to pass an object/handle to the callbacks, this is unique for each peripheral, and from it you can determine the source.
Here you'd build an if/then/else tree via htim->Instance == TIMx
2018-07-08 06:04 AM
The mechanics of the HAL is to pass an object/handle to the callbacks, this is unique for each peripheral, and from it you can determine the source.
Here you'd build an if/then/else tree via htim->Instance == TIMx
2018-07-08 09:38 AM
Thank you.
is there any resource to study these more in depth?
Also I'm looking for a source that explains timer trigger, compare and all sort of staff.
2018-07-08 09:53 AM
The HAL is provided with complete source code, and the code trees contain dozens of examples and demo applications, for dozens of boards.
Use a file manager, or static analysis tool of your own preference to navigates the available resources, find examples that closely match your goals and port to the target platform.
2018-07-08 10:08 AM
Do these sources get installed in accompany with the CubeMX? I can not find them in the installation path.