Is there a simple GPIO Interrupt example for the ARM Cortex-M3?
I have written some code, however somehow the interrupt does not seem to fire:
#include "LPC17xx.h"
#include "lpc17xx_pinsel.h"
#include "lpc17xx_gpio.h"
void EINT3_IRQHandler(void) {
NVIC_ClearPendingIRQ(EINT3_IRQn);
puts("triggered"); // fired
}
int main() {
/** ... **/
/** ... **/
// listen for input on INPUT pin @ GPIO port 1, pin 31
PINSEL_CFG_Type PinCfg;
PinCfg.Funcnum = 0;
PinCfg.OpenDrain = 0;
PinCfg.Pinmode = 0;
PinCfg.Portnum = 1;
PinCfg.Pinnum = 31;
PINSEL_ConfigPin(&PinCfg);
GPIO_SetDir(port, 1 << pin, 0);
NVIC_EnableIRQ(EINT3_IRQn);
while(1); // wait
/** ... **/
/** ... **/
return 0;
}
I have been searching online / GitHub for a simple GPIO interrupt example for the LPC1769 Cortex M3, but it yields no results. It appears however that:
- the GPIO interrupt of interest is
EINT_3. - the IRQ handler
EINT3_IRQHandlergets overwritten, when defined in user code.
What is wrong?