Skip to content

Commit c2bc4a9

Browse files
committed
Untangle code and remove pylint disables
1 parent ad088b4 commit c2bc4a9

File tree

4 files changed

+9
-22
lines changed

4 files changed

+9
-22
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
elif b"brcm,bcm2712" in compat:
3232
board_reqs = [
3333
"rpi_ws281x>=4.0.0",
34-
"rpi-lgpio",
34+
"lgpio",
3535
"Adafruit-Blinka-Raspberry-Pi5-Neopixel",
3636
]
3737
# Pi 4 and Earlier

src/adafruit_blinka/microcontroller/bcm2711/pin.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
# SPDX-License-Identifier: MIT
44
"""Broadcom BCM2711 pin names"""
55

6-
# pylint: disable=unused-import
7-
# importing CHIP to make the lgpio CHIP handle available
8-
from adafruit_blinka.microcontroller.bcm283x.pin import Pin, CHIP
9-
10-
# pylint: enable=unused-import
6+
from adafruit_blinka.microcontroller.bcm283x.pin import Pin
117

128
D0 = Pin(0)
139
D1 = Pin(1)

src/adafruit_blinka/microcontroller/bcm283x/pin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Pin:
6363
lgpio.exceptions = True
6464

6565
def __init__(self, bcm_number):
66-
self.id = bcm_number # pylint: disable=invalid-name
66+
self.id = bcm_number
6767

6868
def __repr__(self):
6969
return str(self.id)

src/adafruit_blinka/microcontroller/bcm283x/pwmio/PWMOut.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
1-
# pylint: disable=invalid-name
21
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
32
#
43
# SPDX-License-Identifier: MIT
5-
# pylint: enable=invalid-name
4+
65
""" PWMOut Class for lgpio lg library tx_pwm library """
76

87
import lgpio
9-
import board # need board to get access to the CHIP object in the pin module
8+
from adafruit_blinka.microcontroller.bcm283x.pin import CHIP
109

1110

12-
# pylint: disable=unnecessary-pass
1311
class PWMError(IOError):
1412
"""Base class for PWM errors."""
1513

16-
pass
17-
18-
19-
# pylint: enable=unnecessary-pass
2014

21-
22-
class PWMOut: # pylint: disable=invalid-name
15+
class PWMOut:
2316
"""Pulse Width Modulation Output Class"""
2417

2518
def __init__(self, pin, *, frequency=500, duty_cycle=0, variable_frequency=False):
2619
if variable_frequency:
2720
print("Variable Frequency is not supported, ignoring...")
2821
self._pin = pin
29-
result = lgpio.gpio_claim_output(
30-
board.pin.CHIP, self._pin.id, lFlags=lgpio.SET_PULL_NONE
31-
)
22+
result = lgpio.gpio_claim_output(CHIP, self._pin.id, lFlags=lgpio.SET_PULL_NONE)
3223
if result < 0:
3324
raise RuntimeError(lgpio.error_text(result))
3425
self._enabled = False
@@ -46,7 +37,7 @@ def __del__(self):
4637
def __enter__(self):
4738
return self
4839

49-
def __exit__(self, exc_type, exc_val, exc_tb):
40+
def __exit__(self, _exc_type, _exc_val, _exc_tb):
5041
self.deinit()
5142

5243
def deinit(self):
@@ -154,7 +145,7 @@ def enabled(self, value):
154145
frequency = self._frequency if value else 0
155146
duty_cycle = round(self._duty_cycle * 100)
156147
self._enabled = value
157-
result = lgpio.tx_pwm(board.pin.CHIP, self._pin.id, frequency, duty_cycle)
148+
result = lgpio.tx_pwm(CHIP, self._pin.id, frequency, duty_cycle)
158149
if result < 0:
159150
raise RuntimeError(lgpio.error_text(result))
160151
return result

0 commit comments

Comments
 (0)