]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Untangle code and remove pylint disables
authorMelissa LeBlanc-Williams <melissa@adafruit.com>
Thu, 13 Mar 2025 22:28:25 +0000 (15:28 -0700)
committerMelissa LeBlanc-Williams <melissa@adafruit.com>
Thu, 13 Mar 2025 22:28:25 +0000 (15:28 -0700)
setup.py
src/adafruit_blinka/microcontroller/bcm2711/pin.py
src/adafruit_blinka/microcontroller/bcm283x/pin.py
src/adafruit_blinka/microcontroller/bcm283x/pwmio/PWMOut.py

index 92ce579bf3cb4ad397a37718ea86cf322393ffa9..b793194a77aaa833dedbf8ba698bf4b391e9b3a3 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -31,7 +31,7 @@ if os.path.exists("/proc/device-tree/compatible"):
     elif b"brcm,bcm2712" in compat:
         board_reqs = [
             "rpi_ws281x>=4.0.0",
-            "rpi-lgpio",
+            "lgpio",
             "Adafruit-Blinka-Raspberry-Pi5-Neopixel",
         ]
     # Pi 4 and Earlier
index 59ac99a0aee1fd0abc5e6f72e88acc1c2b990370..c0aedde86d7c6166a4ccd36bfd40cf72c7f7bbf9 100644 (file)
@@ -3,11 +3,7 @@
 # SPDX-License-Identifier: MIT
 """Broadcom BCM2711 pin names"""
 
-# pylint: disable=unused-import
-# importing CHIP to make the lgpio CHIP handle available
-from adafruit_blinka.microcontroller.bcm283x.pin import Pin, CHIP
-
-# pylint: enable=unused-import
+from adafruit_blinka.microcontroller.bcm283x.pin import Pin
 
 D0 = Pin(0)
 D1 = Pin(1)
index ddd377f8eb467d9b027afd3c20822a642098c3db..e31d401249d68f12fac8a63460b1046af3ba163a 100644 (file)
@@ -63,7 +63,7 @@ class Pin:
     lgpio.exceptions = True
 
     def __init__(self, bcm_number):
-        self.id = bcm_number  # pylint: disable=invalid-name
+        self.id = bcm_number
 
     def __repr__(self):
         return str(self.id)
index 009ae36dd7328b6b179a999f6e2ae61913e47abf..3633cebd62d3cd87f4e0b774771459a32373ec7a 100644 (file)
@@ -1,34 +1,25 @@
-# pylint: disable=invalid-name
 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
 #
 # SPDX-License-Identifier: MIT
-# pylint: enable=invalid-name
+
 """ PWMOut Class for lgpio lg library tx_pwm library """
 
 import lgpio
-import board  # need board to get access to the CHIP object in the pin module
+from adafruit_blinka.microcontroller.bcm283x.pin import CHIP
 
 
-# pylint: disable=unnecessary-pass
 class PWMError(IOError):
     """Base class for PWM errors."""
 
-    pass
-
-
-# pylint: enable=unnecessary-pass
 
-
-class PWMOut:  # pylint: disable=invalid-name
+class PWMOut:
     """Pulse Width Modulation Output Class"""
 
     def __init__(self, pin, *, frequency=500, duty_cycle=0, variable_frequency=False):
         if variable_frequency:
             print("Variable Frequency is not supported, ignoring...")
         self._pin = pin
-        result = lgpio.gpio_claim_output(
-            board.pin.CHIP, self._pin.id, lFlags=lgpio.SET_PULL_NONE
-        )
+        result = lgpio.gpio_claim_output(CHIP, self._pin.id, lFlags=lgpio.SET_PULL_NONE)
         if result < 0:
             raise RuntimeError(lgpio.error_text(result))
         self._enabled = False
@@ -46,7 +37,7 @@ class PWMOut:  # pylint: disable=invalid-name
     def __enter__(self):
         return self
 
-    def __exit__(self, exc_type, exc_val, exc_tb):
+    def __exit__(self, _exc_type, _exc_val, _exc_tb):
         self.deinit()
 
     def deinit(self):
@@ -154,7 +145,7 @@ class PWMOut:  # pylint: disable=invalid-name
         frequency = self._frequency if value else 0
         duty_cycle = round(self._duty_cycle * 100)
         self._enabled = value
-        result = lgpio.tx_pwm(board.pin.CHIP, self._pin.id, frequency, duty_cycle)
+        result = lgpio.tx_pwm(CHIP, self._pin.id, frequency, duty_cycle)
         if result < 0:
             raise RuntimeError(lgpio.error_text(result))
         return result