Exemplo n.º 1
0
 def test_setup_expanded_gpio(self):
     GPIO.setup("XIO-P1", GPIO.OUT)
     base = GPIO.get_gpio_base() + 1
     gfile = '/sys/class/gpio/gpio%d' % base
     assert os.path.exists(gfile)
     GPIO.cleanup()
     assert not os.path.exists(gfile)
Exemplo n.º 2
0
 def test_setup_expanded_gpio(self):
     GPIO.setup("XIO-P1", GPIO.OUT)
     base = GPIO.get_gpio_base() + 1
     gfile = '/sys/class/gpio/gpio%d' % base
     assert os.path.exists(gfile)
     GPIO.cleanup()
     assert not os.path.exists(gfile)
Exemplo n.º 3
0
 def test_start_pwm(self):
     PWM.start("XIO-P7", 50, 10)
     base = GPIO.get_gpio_base() + 7
     gfile = '/sys/class/gpio/gpio%d' % base
     assert os.path.exists(gfile)
     direction = open(gfile + '/direction').read()
     assert(direction == 'out\n')
     PWM.cleanup()
Exemplo n.º 4
0
 def test_start_pwm(self):
     PWM.start("XIO-P7", 50, 10)
     base = GPIO.get_gpio_base() + 7
     gfile = '/sys/class/gpio/gpio%d' % base
     assert os.path.exists(gfile)
     direction = open(gfile + '/direction').read()
     assert(direction == 'out\n')
     PWM.cleanup()
Exemplo n.º 5
0
print("VERIFYING EDGE DETECT WAS SET PROPERLY")
f = open("/sys/class/gpio/gpio35/edge", "r")
edge = f.read()
f.close()
assert(edge == "both\n")
GPIO.remove_event_detect("AP-EINT3")

# ==============================================
# EDGE DETECTION - EXPANDED GPIO
print("\nSETTING UP FALLING EDGE DETECTION ON XIO-P2")
# WRITING CSID0 LOW FIRST AS THERE IS A DOUBLE HIT ON HIGH
GPIO.output("CSID0", GPIO.LOW)
GPIO.add_event_detect("XIO-P2", GPIO.FALLING, myfuncallback)

print("VERIFYING EDGE DETECT")
base = GPIO.get_gpio_base()
gfile = "/sys/class/gpio/gpio%d/edge" % (base + 2)
f = open(gfile, "r")
edge = f.read()
f.close()
assert(edge == "falling\n")

# LOOP WRITING ON CSID0 TO HOPEFULLY GET CALLBACK TO WORK
print("WAITING FOR CALLBACKS ON XIO-P2")
loopfunction()
mystr = " num_callbacks = %d" % num_callbacks
print(mystr)
GPIO.remove_event_detect("XIO-P2")

print("\nSETTING UP RISING EDGE DETECTION ON XIO-P2")
# WRITING CSID0 LOW FIRST AS THERE IS A DOUBLE HIT ON HIGH
Exemplo n.º 6
0
print("VERIFYING EDGE DETECT WAS SET PROPERLY")
f = open("/sys/class/gpio/gpio35/edge", "r")
edge = f.read()
f.close()
assert (edge == "both\n")
GPIO.remove_event_detect("AP-EINT3")

# ==============================================
# EDGE DETECTION - EXPANDED GPIO
print("\nSETTING UP FALLING EDGE DETECTION ON XIO-P2")
# WRITING CSID0 LOW FIRST AS THERE IS A DOUBLE HIT ON HIGH
GPIO.output("CSID0", GPIO.LOW)
GPIO.add_event_detect("XIO-P2", GPIO.FALLING, myfuncallback)

print("VERIFYING EDGE DETECT")
base = GPIO.get_gpio_base()
gfile = "/sys/class/gpio/gpio%d/edge" % (base + 2)
f = open(gfile, "r")
edge = f.read()
f.close()
assert (edge == "falling\n")

# LOOP WRITING ON CSID0 TO HOPEFULLY GET CALLBACK TO WORK
print("WAITING FOR CALLBACKS ON XIO-P2")
loopfunction()
mystr = " num_callbacks = %d" % num_callbacks
print(mystr)
GPIO.remove_event_detect("XIO-P2")

print("\nSETTING UP RISING EDGE DETECTION ON XIO-P2")
# WRITING CSID0 LOW FIRST AS THERE IS A DOUBLE HIT ON HIGH