Hello,
Is there any limitation on the pins where we can attach an interrupt on the tm4c123gh6pm?
And also, when we have 2 pins on the same port that are interrupt pins, do we attach multiple isr's per pin or just one isp per port:
Looking from examples, I have done something like:
void isr(void) {
if(GPIOIntStatus(GPIO_PORTC_BASE, true) & GPIO_PIN_6) {
GPIOIntClear(GPIO_PORTC_BASE, GPIO_PIN_6);
} else if(GPIOIntStatus(GPIO_PORTC_BASE, true) & GPIO_PIN_5) {
GPIOIntClear(GPIO_PORTC_BASE, GPIO_PIN_5);
}
}
And I initialize both pins with:
GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_5 | GPIO_PIN_6);
GPIOPadConfigSet(GPIO_PORTC_BASE, GPIO_PIN_5 | GPIO_PIN_6, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
GPIOIntDisable(GPIO_PORTC_BASE, GPIO_PIN_5 | GPIO_PIN_6);
GPIOIntClear(GPIO_PORTC_BASE, GPIO_PIN_5 | GPIO_PIN_6);
GPIOIntRegister(GPIO_PORTC_BASE, isr);
GPIOIntTypeSet(GPIO_PORTC_BASE, GPIO_PIN_5 | GPIO_PIN_6, GPIO_RISING_EDGE);
GPIOIntEnable(GPIO_PORTC_BASE, GPIO_PIN_5 | GPIO_PIN_6);
And in my ISR's I usually set a volatile boolean to true, then process this in my main loop.
Is there a better way of doing this? For example instead of clearing the interrupt inside the isr, could i check in my main loop GPIOIntStatus(GPIO_PORTC_BASE, true) and then clear the interrupt. (provided that another interrupt will not come before the loop processes it.
Best Regards,
C.A.