Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

how to do interrupt drive GPIO input in python?

Featured Replies

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?

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++

  • Author

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?

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.