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.

Orange Pi - WiringPi - Python and Interrupts?

Featured Replies

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

 

  • Author

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. 

 

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

 

  • Author

OK, thank you, I'll try this.  I really appreciate.

 

So I need to use C language for interrupts - as far as I understand...

 

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.