diff options
author | Devaev Maxim <[email protected]> | 2019-03-18 02:00:58 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-03-18 03:32:14 +0300 |
commit | d049400a97d7c0d785298f23c34bd4e3ed612f36 (patch) | |
tree | aaaa299770c0be464bcbd9728e60903202ca1e2f /kvmd/gpio.py | |
parent | d1a6d79af5043ba8c0b2e085e0ca32922d8b23e1 (diff) |
optional msd and atx
Diffstat (limited to 'kvmd/gpio.py')
-rw-r--r-- | kvmd/gpio.py | 4 |
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) |