def irqWait(self, timeout = 30000):
# CHANGE: detect module name because wait_for_edge is not available in
# other libraries
if GPIO.__name__ != "Adafruit_BBIO.GPIO":
return False
# TODO: A race condition may occur here.
if GPIO.input(self.irq_pin) == 0: # Pin is already down. Packet is waiting?
return True
return GPIO.wait_for_edge(self.irq_pin, GPIO.FALLING, timeout) == 1
评论列表
文章目录