From 84c6bcbd649324e8e1e6eae5ef9a5567fefa7e3e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 11 Dec 2024 15:39:32 -0600 Subject: [PATCH 1/2] neopixel_write: Use new pio-based code on pi5 --- setup.py | 2 +- src/neopixel_write.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 4ed24be2..6178044d 100755 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ board_reqs = ["RPi.GPIO", "rpi_ws281x>=4.0.0"] # Pi 5 if b"brcm,bcm2712" in compat: - board_reqs = ["rpi_ws281x>=4.0.0", "rpi-lgpio"] + board_reqs = ["rpi_ws281x>=4.0.0", "rpi-lgpio", "Adafruit-Blinka-Raspberry-Pi5-Neopixel"] if ( b"ti,am335x" in compat ): # BeagleBone Black, Green, PocketBeagle, BeagleBone AI, etc. diff --git a/src/neopixel_write.py b/src/neopixel_write.py index 77e57767..765d9c04 100644 --- a/src/neopixel_write.py +++ b/src/neopixel_write.py @@ -13,10 +13,13 @@ # pylint: disable=too-many-boolean-expressions import sys -from adafruit_blinka.agnostic import detector +from adafruit_blinka.agnostic import detector, board_id if detector.board.any_raspberry_pi: - from adafruit_blinka.microcontroller.bcm283x import neopixel as _neopixel + if board_id == "RASPBERRY_PI_5": + import adafruit_raspberry_pi5_neopixel_write as _neopixel + else: + from adafruit_blinka.microcontroller.bcm283x import neopixel as _neopixel elif detector.board.pico_u2if: from adafruit_blinka.microcontroller.rp2040_u2if import neopixel as _neopixel elif detector.board.OS_AGNOSTIC_BOARD: From a7ebb5636236d7866eef7f3ac5bc844f9118490f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 11 Dec 2024 17:18:58 -0600 Subject: [PATCH 2/2] fix issues highlighted by pre-commit --- setup.py | 6 +++++- src/neopixel_write.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 6178044d..5ec42311 100755 --- a/setup.py +++ b/setup.py @@ -37,7 +37,11 @@ board_reqs = ["RPi.GPIO", "rpi_ws281x>=4.0.0"] # Pi 5 if b"brcm,bcm2712" in compat: - board_reqs = ["rpi_ws281x>=4.0.0", "rpi-lgpio", "Adafruit-Blinka-Raspberry-Pi5-Neopixel"] + board_reqs = [ + "rpi_ws281x>=4.0.0", + "rpi-lgpio", + "Adafruit-Blinka-Raspberry-Pi5-Neopixel", + ] if ( b"ti,am335x" in compat ): # BeagleBone Black, Green, PocketBeagle, BeagleBone AI, etc. diff --git a/src/neopixel_write.py b/src/neopixel_write.py index 765d9c04..641a2021 100644 --- a/src/neopixel_write.py +++ b/src/neopixel_write.py @@ -10,7 +10,7 @@ * Author(s): ladyada """ -# pylint: disable=too-many-boolean-expressions +# pylint: disable=too-many-boolean-expressions, ungrouped-imports import sys from adafruit_blinka.agnostic import detector, board_id