bozden Posted April 16, 2017 Posted April 16, 2017 I build a device with several buttons, sensors etc. Implemented in python. I selected WiringOP for GPIO and installed it with some tweaking. First version is implemented in polling mode. Whenever I start interrupt driven code, I got stuck. No such support as far as I can see. How can I handle this? Thanks
bozden Posted April 16, 2017 Author Posted April 16, 2017 No one? I can choose another library and/or use C for interrupt handling etc. What is the good and stable way of doing this? Can somebody please point me to the right direction? There are many related posts around, but they are relatively old and I could not find a solid answer.
nopnop2002 Posted April 17, 2017 Posted April 17, 2017 18 hours ago, bozden said: No one? I can choose another library and/or use C for interrupt handling etc. What is the good and stable way of doing this? Can somebody please point me to the right direction? There are many related posts around, but they are relatively old and I could not find a solid answer. #include <wiringPi.h> #include <stdio.h> #define pin_22 6 // pin#22(PA2) #define pin_26 11 // pin#26(PA21) #define pin_28 31 // pin#28(PA18) void int_falling(void){ printf("%s\n",__func__); } void int_rising(void){ printf("%s\n",__func__); } void int_both(void){ printf("%s\n",__func__); } int main(void){ printf("pi interrupt test start !!\n"); if (wiringPiSetup() == -1){ printf("wiringPiSetup init error\n"); return(1); } pinMode(pin_22, INPUT); pinMode(pin_26, INPUT); pinMode(pin_28, INPUT); wiringPiISR(pin_22,INT_EDGE_FALLING, &int_falling ); wiringPiISR(pin_26,INT_EDGE_RISING, &int_rising ); wiringPiISR(pin_28,INT_EDGE_BOTH, &int_both ); while(1){ } return 0; } This code work Rpi & Opi. $ uname -a Linux orangepipc 3.4.113-sun8i #10 SMP PREEMPT Thu Feb 23 19:55:00 CET 2017 armv7l GNU/Linux
bozden Posted April 22, 2017 Author Posted April 22, 2017 OK, thank you, I'll try this. I really appreciate. So I need to use C language for interrupts - as far as I understand...
Recommended Posts