cancel
Showing results for 
Search instead for 
Did you mean: 

Two questions about HAL_GPIO_EXTI_IRQHandler

dhs
Senior

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4

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
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

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

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

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