Timeline for Why are MSPs in STM32 HAL defined as callback functions?
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 10, 2022 at 14:27 | comment | added | Justme | OK, the MX_TIM1_Init() is not HAL code, it is just user code generated for you, which simply calls the HAL to init the timer and finally calls HAL_TIM_MspPostInit() which is sort of HAL support code but pregenerated for you based on how you wanted the timer to be configured. I would not say it is a callback in this case, as it's not called back by the HAL. | |
Mar 10, 2022 at 13:58 | comment | added | GNZ | Please see my edit. I tried to pinpoint my confusion. | |
Mar 9, 2022 at 13:33 | comment | added | GNZ | "I don't think C standard does not define" or you wanted to say "I don't think C standard defines" ? | |
Mar 9, 2022 at 13:10 | comment | added | Justme | I don't think C standard does not define what you can or cannot call a callback, so there is no strict definition for a callback. If C standard defines the term please mention where. In this case you have to implement the function that is specific to your platform/project and it is called by the generic HAL to init your board. Nobody else calls your function except the HAL. Thus it can be called a callback, even if you don't specify to the HAL which function you want to be called, as it is implicit. | |
Mar 9, 2022 at 12:14 | comment | added | GNZ | Can you give an example? Is there any callback in my question? I cant see any function pointer as argument. Thats a must in C to be called a callback. | |
Mar 9, 2022 at 11:04 | history | answered | Justme | CC BY-SA 4.0 |