summaryrefslogtreecommitdiff
path: root/kvmd/gpio.py
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/gpio.py')
-rw-r--r--kvmd/gpio.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/kvmd/gpio.py b/kvmd/gpio.py
index fccdf936..fbcdba99 100644
--- a/kvmd/gpio.py
+++ b/kvmd/gpio.py
@@ -43,18 +43,22 @@ def bcm() -> Generator[None, None, None]:
def set_output(pin: int, initial: bool=False) -> int:
+ assert pin > 0, pin
GPIO.setup(pin, GPIO.OUT, initial=initial)
return pin
def set_input(pin: int) -> int:
+ assert pin > 0, pin
GPIO.setup(pin, GPIO.IN)
return pin
def read(pin: int) -> bool:
+ assert pin > 0, pin
return bool(GPIO.input(pin))
def write(pin: int, flag: bool) -> None:
+ assert pin > 0, pin
GPIO.output(pin, flag)