2019-04-05 02:57 PM
I'm trying to wrap my head around HAL_GPIO_EXTI_IRQHandler...
Why is only the "Pin" used in the parameter, and not the "Port". Really, why not both?
According to en.DM00031020.pdf page 382 section 12.2.5 "External interrupt/event line mapping", it appears EXTI# is already mapped to a given Pin# for every port.
So if EXTI0_IRQHandler is triggered, it is supposedly meant for ANY port that had a Pin0 assigned, that was interrupted.
Let's say I have 2 buttons on PortA,Pin0 and PortB,Pin0.
It sounds like they are both tied to that same EXTI0_IRQHandler.
When "HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0);" is called inside of it, it is being told it is supposed to do something with Pin0 ("__HAL_GPIO_EXTI_CLEAR_IT" and callback) for that Pin, but there is NO knowledge of what port it's associated with.
Let's say 1 of those buttons (PortA,Pin0) is supposed to trigger the opening of a front door, and the other one (PortB,Pin0) for the back door.
When the interrupt is called, it knows the button on Pin0 was pressed, but doesn't know if it was for the front or back door.
How is the callback supposed to know which door to open when it only knows one of those buttons was pressed?
2019-04-05 03:21 PM
Clarity was received in the IRC from zyp who pointed out that Px0 and Px0 will never be able to be wired up at the same time due to section 9.2.3 on page 291 "SYSCFG external interrupt configuration register 1" which shows "Bits 15:0" can only take ONE of those ports.
2019-04-05 10:20 PM
EXTI restriction with impact on package pinout selection:
Only one port for one specific pin index.
Example: You can't have PA4 and PC4 both as EXTI.