I'm trying to get a GPIO edge interrupt to work on Port 0 Pin 20 of an LPC11U24, but I can't figure it out. My code is as follows:
InitInterrupt()
{
NVIC_DisableIRQ(FLEX_INT0_IRQn);
LPC_SYSCON->SYSAHBCLKCTRL |= 0x01 << 19;
LPC_SYSCON->SYSAHBCLKCTRL |= 0x01 << 23;
LPC_GPIO->DIR[0] &= ~(ANX_INTP);
LPC_SYSCON->PINTSEL[0] = 20;
LPC_GPIO_PIN_INT->ISEL &= ~0x01;
LPC_GPIO_PIN_INT->IENR |= 0x01;
LPC_GPIO_PIN_INT->SIENR |= 0x01;
NVIC_EnableIRQ(FLEX_INT0_IRQn);
}
The interrupt:
void FLEX_INT0_IRQHandler(void)
{
uint32_t intStat = 0;
intStat = LPC_GPIO_PIN_INT->IST;
LPC_GPIO_PIN_INT->IST = intStat;
NVIC_ClearPendingIRQ(FLEX_INT0_IRQn);
}
Can anyone tell me what I am doing wrong?