dony71 Posted September 6, 2016 Posted September 6, 2016 RPi has this interrupt driven GPIO input detection GPIO.add_event_detect(pin_number, GPIO.BOTH, callback=callback_function) Orange Pi has already this python GPIO function https://github.com/duxingkei33/orangepi_PC_gpio_pyH3 But I see only gpio.input(pin_number) function for GPIO input detection Anybody can answer whether possible to substitute RPi interrupt driven GPIO input detection?
StaLeWaR Posted September 6, 2016 Posted September 6, 2016 Yes. use WiringOP from WereCatf https://github.com/WereCatf/WiringOP example(from my ) void rpmInterrupt(void) { pulseCounter++; } .... void rpmFan(void) { pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); wiringPiSetup () ; pinMode(PIN_RPM, INPUT); pullUpDnControl (PIN_RPM, PUD_UP) ; wiringPiISR (PIN_RPM, INT_EDGE_FALLING, &rpmInterrupt); while (1) { rpm=(pulseCounter/HALL_PULSE)*60 ; pulseCounter = 0; delayMicroseconds ( 1000000 ); //cheÑk every 1 second } } It works. But this is C++
dony71 Posted September 7, 2016 Author Posted September 7, 2016 Yes. use WiringOP from WereCatf https://github.com/WereCatf/WiringOP example(from my ) void rpmInterrupt(void) { pulseCounter++; } .... void rpmFan(void) { pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); wiringPiSetup () ; pinMode(PIN_RPM, INPUT); pullUpDnControl (PIN_RPM, PUD_UP) ; wiringPiISR (PIN_RPM, INT_EDGE_FALLING, &rpmInterrupt); while (1) { rpm=(pulseCounter/HALL_PULSE)*60 ; pulseCounter = 0; delayMicroseconds ( 1000000 ); //cheÑk every 1 second } } It works. But this is C++ any python wrapper for this?
Recommended Posts