In STM32CubeMX MSP stands for MCU Support Package and of all here is what it basically about:
MSPs are user callback functions to perform system level initializations such as (Clock, GPIOs, DMA, interrupts).
Now I'm looking at such a function used as:
HAL_TIM_MspPostInit(&htim2);
And when I open declaration it is found under stm32f3xx_hal_msp.c as:
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(htim->Instance==TIM2)
{
/* USER CODE BEGIN TIM2_MspPostInit 0 */
/* USER CODE END TIM2_MspPostInit 0 */
__HAL_RCC_GPIOA_CLK_ENABLE();
/**TIM2 GPIO Configuration
PA0 ------> TIM2_CH1
*/
GPIO_InitStruct.Pin = GPIO_PIN_0;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_TIM2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USER CODE BEGIN TIM2_MspPostInit 1 */
/* USER CODE END TIM2_MspPostInit 1 */
}
Now in C callback function is a function which its pointer is passed to another function. Here selected answer is an example.
My question is: What makes MSPs callback functions? They get structs passed as arguments not functions. And where are the callbacks in MSPs? I could not see the footprint of a callback function there. An example would help.