Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interrupts in Beaglebone

I am reading a hall sensor output in beaglebone gpio pin, for every rising edge the interrupt service routine needs to execute. So, how to use external interrupt in beaglebone? and is there any standard driver for this purpose?

Thanks.

like image 217
duslabo Avatar asked Aug 06 '12 15:08

duslabo


2 Answers

Yes there is a standard driver. This page here shows the basic steps for using gpio's.

like image 80
TJD Avatar answered Nov 17 '22 14:11

TJD


In Python using Adafruit Libray,

import Adafruit_BBIO.GPIO as GPIO 

Pin = "P8_8" 
GPIO.setup(Pin, GPIO.IN)    # set GPIO25 as input (button)  

def my_callback(channel):  
    if GPIO.input(Pin):    
        print "Rising edge detected on 25"  
    else:                  # if port 25 != 1  
        print "Falling edge detected on 25" 

GPIO.add_event_detect(Pin, GPIO.BOTH, my_callback, 1)

Here is reference link.

like image 3
Vijay Panchal Avatar answered Nov 17 '22 14:11

Vijay Panchal