cancel
Showing results for 
Search instead for 
Did you mean: 

What is the differences between "EXTI_Callback" and "EXTI_IRQHandler"?

vtran1
Associate II

In the sample code, STM uses "HAL_GPIO_EXTI_Callback" to handle interrupt from a push button, but in class I learnt that we need to use the IRQHandler to handle the interrupt. When to use "HAL_GPIO_EXTI_Callback" and "HAL_GPIO_EXTI_IRQHandler" to handle interrupt?

1 ACCEPTED SOLUTION

Accepted Solutions

The IRQ Handler is the thing that actually gets called by the NVIC, you then call into the HAL via HAL_GPIO_EXTI_IRQHandler(), and then it in turn calls your callback functions if it validates a specific source, it also then clears the source as it leaves.

HAL just layers on some extra complexity, you can chose to use or ignore that if you wish.

/**

 * @brief This function handles external line 15_10 interrupt request.

 * @param None

 * @retval None

 */

void EXTI15_10_IRQHandler(void) // << Processor goes here via Vector Table

{

 HAL_GPIO_EXTI_IRQHandler(USER_BUTTON_PIN); // >> Goes INTO HAL here, and then out to your callback

}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

1 REPLY 1

The IRQ Handler is the thing that actually gets called by the NVIC, you then call into the HAL via HAL_GPIO_EXTI_IRQHandler(), and then it in turn calls your callback functions if it validates a specific source, it also then clears the source as it leaves.

HAL just layers on some extra complexity, you can chose to use or ignore that if you wish.

/**

 * @brief This function handles external line 15_10 interrupt request.

 * @param None

 * @retval None

 */

void EXTI15_10_IRQHandler(void) // << Processor goes here via Vector Table

{

 HAL_GPIO_EXTI_IRQHandler(USER_BUTTON_PIN); // >> Goes INTO HAL here, and then out to your callback

}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..