Interrupt on both edges and measure time between them

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Interrupt on both edges and measure time between them

506 Views
esam_me
Contributor II

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

  • Im Wörterbuch speichern
     
    • Keine Wortliste für Englisch -> Arabisch...
       
    • Eine neue Wortliste erstellen...
  • Kopieren
0 Kudos
1 Reply

495 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello esam_me,

 

Please check how do you config this register: GPIO interrupt both edges sense register

 
 
 

Regards,

Alice

 

0 Kudos