Hi, my environment is:
Orange Pi One
ARMBIAN 5.34.171031 nightly Ubuntu 16.04.3 LTS 4.11.12-sun8i
WiringPi fork by WereCatf:
git clone https://github.com/WereCatf/WiringOP.git -b h3
./build
small c++ programm:
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <wiringPi.h>
#include <pthread.h>
static volatile int globalCounter;
void myInterrupt(void) {
++globalCounter;
printf("InterruptCounter: %5d\n", globalCounter);
//digitalRead(7);
}
int main(void)
{
if (wiringPiSetup() == -1) {
printf("wiringPiSetup Error\n");
}
pinMode(7, INPUT);
pullUpDnControl(7, PUD_UP);
if (wiringPiISR(7, INT_EDGE_FALLING, &myInterrupt) < 0)
{
fprintf(stderr, "Unable to setup ISR: %s\n", strerror(errno));
return 1;
}
for (;;)
{
//main programm code here...
}
return 0;
}
Compile:
gcc ./isr.c -o wg-daemon.out -lwiringPi -lwiringPiDev -lpthread -lm
and run it...
but when I put pin 7 in down state (gpio mode 7 down) ISR function begin fires (triggers) continuously (((((((
Here is output :
InterruptCounter: 132371
InterruptCounter: 132372
InterruptCounter: 132373
InterruptCounter: 132374
InterruptCounter: 132375
InterruptCounter: 132376
InterruptCounter: 132377
InterruptCounter: 132378
InterruptCounter: 132379
InterruptCounter: 132380
InterruptCounter: 132381
^C
root@orangepione:~/example#
but, when I add to ISR function
"digitalRead(7);"
program works fine (((
Please tell me, what I do wrong