Skip to main content
Senior
December 8, 2022
Solved

Two questions about HAL_GPIO_EXTI_IRQHandler

  • December 8, 2022
  • 4 replies
  • 3751 views

1- Using cubre-mx I enabled two IRQ lines, each generate its own ISR

void EXTI0_IRQHandler(void)

{

HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0);

}

and

void EXTI15_10_IRQHandler(void)

{

HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0);

}

Why HAL joint together both IRQ handlers in one function, isn't better to use two separate functions ?

2 - Later why use the name callback, this name should be reserved for functions used as parameter on functions?

This topic has been closed for replies.
Best answer by Tesla DeLorean

Presumably the latter one is supposed to be calling with GPIO_PIN10 thru 15

HAL is a monster, it is going to qualify the source, call your callback, and clear the source.

They have one gate keeper function.

If you want efficiency do your work in the IRQHandler directly.

4 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
December 8, 2022

Presumably the latter one is supposed to be calling with GPIO_PIN10 thru 15

HAL is a monster, it is going to qualify the source, call your callback, and clear the source.

They have one gate keeper function.

If you want efficiency do your work in the IRQHandler directly.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
dhsAuthor
Senior
January 2, 2023

By default, do you start a new project using HAL or avoid it from the very bebining ?

Daniel H Sagarra
TDK
December 9, 2022

EXTI0_IRQHandler and EXTI15_10_IRQHandler are tied to interrupts in the core. No way to merge those.

> isn't better to use two separate functions ?

Hard to make sweeping generalizations like that. The most common practice is that a single function is better as it reduces code duplication.

> Later why use the name callback

It needs to know which pin to check EXTI flags for.

"If you feel a post has answered your question, please click ""Accept as Solution""."
S.Ma
Principal
December 10, 2022

Well HAL code didn't understand the reason to have split EXTI interrupt vectors in the chip, simply said....