2022-12-08 12:23 PM
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?
Solved! Go to Solution.
2022-12-08 02:08 PM
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.
2022-12-08 02:08 PM
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.
2022-12-09 10:18 AM
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.
2022-12-09 08:03 PM
Well HAL code didn't understand the reason to have split EXTI interrupt vectors in the chip, simply said....
2023-01-02 12:48 PM
By default, do you start a new project using HAL or avoid it from the very bebining ?