Closed nopnop2002 closed 7 years ago
GPIO has interrups in other driver enabled in Armbian. It works with the WereCatf's fork.
I tried this code using WereCatf's fork. But even if a button was pressed, an event didn't occur. Is an additional driver somewhat necessary?
`#include
void signal(void){ printf("Signal\n"); }
int main(void){ if(wiringPiSetup() == -1) { printf("wiringPiSetup Error\n"); } pinMode(pin,INPUT); wiringPiISR(pin, INT_EDGE_FALLING, signal ); // wiringPiISR(pin, INT_EDGE_RISING, signal ); while(1) { sleep(10000); } return 0; } `
WereCatf's fork based on old version, I have merged it with the current fork, better see it.
/sys/class/gpio/
is presented.My example with button between pin 37 (PA20) and pin 39 (Ground):
#define DBTN 37
wiringPiSetupPhys();
pinMode(DBTN, INPUT);
pullUpDnControl(DBTN, PUD_UP);
wiringPiISR(DBTN, INT_EDGE_BOTH, &btn_interrupt) ;
Hello sercxjo. Would your fork also work in Armbian? Is recompiled kernel needed?
GPIO of OPI don't have interrupt function. poll function don't work. So read periodically /sys/class/gpio_sw/XXX/data.(/sys/class/gpio_sw/PA1/data) And change is judged.