STM32F0 Callback function
I am new to embedded world. I am activating the CANBUS peripheral of a STM32F0. I started from the example code of the device given by ST. In the example code there is a callback function that it is executed when the CAN peripheral receive a message (The device is interrupt mode, setup by CubeMX).:
void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef *hcan)
{ // Read CANBUS Messages StdId=hcan->pRxMsg->StdId; Flag_CANext=hcan->pRxMsg->Data[0]; Data1=hcan->pRxMsg->Data[1]; npress = can_receive; intcounter++; //}/* Receive */
if (HAL_CAN_Receive_IT(hcan, CAN_FIFO0) != HAL_OK) { /* Reception Error */ _Error_Handler(__FILE__, __LINE__); }}
The interrupt handler function is specified in the smt32f0xx_it.c file. I am getting confused between the role of the peripheral interrupt handler and the call complete function. My understanding is that the HAL_CAN_Recieive_IT has been already invoked. According to the code generated by CubeMX, which are the functions called during a CANBUS interrupt?
CEC_CAN_IRQHandler(void) -> HAL_CAN_RxCpltCallback(CAN_HandleTypeDef *hcan)
If I want to load the data of the CANBUS is a global variable of the main loop, where is the right place to load the data in the IRQ or Callback function? (as I am doing, shown by the code given above)
#stm32-interrupts