aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm/sys_utils/gpio.py
diff options
context:
space:
mode:
Diffstat (limited to 'mpm/python/usrp_mpm/sys_utils/gpio.py')
-rw-r--r--mpm/python/usrp_mpm/sys_utils/gpio.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/mpm/python/usrp_mpm/sys_utils/gpio.py b/mpm/python/usrp_mpm/sys_utils/gpio.py
index b609479f1..e864149f3 100644
--- a/mpm/python/usrp_mpm/sys_utils/gpio.py
+++ b/mpm/python/usrp_mpm/sys_utils/gpio.py
@@ -30,6 +30,7 @@ class Gpio:
INPUT = gpiod.LINE_REQ_DIR_IN
OUTPUT = gpiod.LINE_REQ_DIR_OUT
+ FALLING_EDGE = gpiod.LINE_REQ_EV_FALLING_EDGE
def __init__(self, name, direction=INPUT, default_val=None):
self._direction = direction
@@ -58,3 +59,12 @@ class Gpio:
with request_gpio(self._line, self._direction) as gpio:
gpio.set_value(int(value))
self._out_value = bool(value)
+
+ def event_wait(self):
+ """
+ Wait for an event to happen on this line
+ """
+ with request_gpio(self._line, self._direction) as gpio:
+ while True:
+ if gpio.event_wait(sec=1):
+ return True