#include <stdio.h>
#include <wiringPi.h>
#include <stdint.h>
#define TRIGGER 2
#define ECHO 3
int IRQcount = 0;
void irq(void) {
//printf("Falling edge\n");
IRQcount++;
}
int main() {
wiringPiSetup();
pinMode(TRIGGER, OUTPUT);
pinMode(ECHO, INPUT);
//Next line fails miserably
wiringPiISR(ECHO, INT_EDGE_RISING, &irq);
for (;;) {
printf("On [%i]\n", IRQcount);
digitalWrite(TRIGGER, HIGH);
delayMicroseconds(4000000);
printf("Off [%i]\n", IRQcount);
digitalWrite(TRIGGER, LOW);
delayMicroseconds(4000000);
}
return (0);
}```
The interrpt is invoked, but then it won't ever stop forever, hitting the callback until I don't stop the program.
It's not bouncing or anything it really keeps beeing called forever.
Is there a way to disarm the irq?