+# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
"""Custom PulseIn Class to read PWM signals"""
import time
import subprocess
queues = []
procs = []
+
# The message queues live outside of python space, and must be formally cleaned!
def final():
"""In case the program is cancelled or quit, we need to clean up the PulseIn
atexit.register(final)
+
# pylint: disable=c-extension-no-member
class PulseIn:
"""PulseIn Class to read PWM signals"""
) from sysv_ipc.ExistentialError
# Check if OS is 64-bit
- if struct.calcsize("P") * 8 == 64:
+ if struct.calcsize("P") * 8 == 64: # pylint: disable=no-member
libgpiod_filename = "libgpiod_pulsein64"
else:
libgpiod_filename = "libgpiod_pulsein"
]
if idle_state:
cmd.append("-i")
- cmd.append("gpiochip0")
- cmd.append(str(pin))
+ if isinstance(pin.id, tuple):
+ cmd.append(f"gpiochip{pin.id[0]}")
+ cmd.append(str(pin.id[1]))
+ else:
+ cmd.append("gpiochip0")
+ cmd.append(str(pin))
if DEBUG:
print(cmd)
- self._process = subprocess.Popen(cmd)
+ self._process = subprocess.Popen(cmd) # pylint: disable=consider-using-with
procs.append(self._process)
# wait for it to start up