I need to set an interrupt on pio0_6 for falling and rising edges and then measure time between them to achieve a long an a short press from a push button.
this is my current code which works only for one edge:
#include "gpio.h"
#include "LPC11xx.h"
int main(){
GPIOInit();
GPIOSetDir(PORT0, 6, 0);// interrupt button- input
GPIOSetInterrupt(PORT0, 6, 0, 0, 1); //Set interrupt on pio0_6
GPIOIntEnable(PORT0, 6);
}
for the IRQ handler in gpio.h:
void PIOINT0_IRQHandler(void)
{
uint32_t regVal;
regVal = GPIOIntStatus( PORT0, 6);// measure pin
if ( regVal )
{
timerInt = 0; //reset inactivity timeout timer
modeInt = 1;
GPIOIntClear( PORT0, 6);
}
return;
}
MCu is LPC1114
Hello esam_me,
Please check how do you config this register: GPIO interrupt both edges sense register
Regards,
Alice