]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Fix pulsein for the Pi 5 and make lockable silent
authorMelissa LeBlanc-Williams <melissa@adafruit.com>
Wed, 27 Dec 2023 21:01:47 +0000 (13:01 -0800)
committerMelissa LeBlanc-Williams <melissa@adafruit.com>
Wed, 27 Dec 2023 21:01:47 +0000 (13:01 -0800)
src/adafruit_blinka/__init__.py
src/adafruit_blinka/microcontroller/bcm283x/pulseio/PulseIn.py

index 5bdb2a5c8935bea18b7fa1620817101ba1ad68d9..a4ef21542d610b3c649ecda0541033e753bf58d1 100755 (executable)
@@ -72,8 +72,6 @@ class Lockable(ContextManaged):
         """Release the lock so others may use the resource."""
         if self._locked:
             self._locked = False
-        else:
-            raise ValueError("Not locked")
 
 
 def patch_system():
index 4f7ae362ddf449d2b9b5f610e0a3227b02188af8..78d5761afcfb6df5cc0191f28d8e240c7b945eb9 100644 (file)
@@ -71,8 +71,12 @@ class 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)