Skip to content

Commit

Permalink
Merge pull request #856 from makermelissa/pi5-pwm-fix2
Browse files Browse the repository at this point in the history
Fix PWM for the Pi 5
  • Loading branch information
makermelissa authored Jun 19, 2024
2 parents ba75eff + 903c5ea commit a1329a8
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 173 deletions.
19 changes: 9 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
Adafruit-PlatformDetect>=3.62.0
Adafruit-PureIO>=1.1.7
Jetson.GPIO; platform_machine=='aarch64'
RPi.GPIO; platform_machine=='armv7l' or platform_machine=='armv6l' or platform_machine=='aarch64'
rpi_ws281x>=4.0.0; platform_machine=='armv7l' or platform_machine=='armv6l' or platform_machine=='aarch64'
sysv_ipc>=1.1.0; sys_platform == 'linux' and platform_machine!='mips'
pyftdi>=0.40.0
binho-host-adapter>=0.1.6
numpy>=1.21.5
adafruit-circuitpython-typing
# requirements.txt
#
# installs dependencies from ./setup.py, and the package itself,
# in editable mode
# -e .

# (the -e above is optional). you could also just install the package
# normally with just the line below (after uncommenting)
.
17 changes: 13 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import io
import os
import sys
import platform

from setuptools import setup, find_packages

Expand All @@ -21,6 +23,7 @@
long_description = "\n" + f.read()

board_reqs = []
platform_reqs = []
if os.path.exists("/proc/device-tree/compatible"):
with open("/proc/device-tree/compatible", "rb") as f:
compat = f.read()
Expand All @@ -34,15 +37,18 @@
or b"brcm,bcm2838" in compat
or b"brcm,bcm2711" in compat
):
board_reqs = ["RPi.GPIO", "rpi_ws281x>=4.0.0", "sysv_ipc>=1.1.0"]
board_reqs = ["RPi.GPIO", "rpi_ws281x>=4.0.0"]
# Pi 5
if b"brcm,bcm2712" in compat:
board_reqs = ["rpi_ws281x>=4.0.0", "sysv_ipc>=1.1.0", "rpi-lgpio"]
board_reqs = ["rpi_ws281x>=4.0.0", "rpi-lgpio"]
if (
b"ti,am335x" in compat
): # BeagleBone Black, Green, PocketBeagle, BeagleBone AI, etc.
board_reqs = ["Adafruit_BBIO"]

if sys.platform == "linux" and platform.machine != "mips":
platform_reqs = ["sysv_ipc>=1.1.0"]

setup(
name="Adafruit-Blinka",
use_scm_version={
Expand Down Expand Up @@ -89,12 +95,15 @@
},
include_package_data=True,
install_requires=[
"Adafruit-PlatformDetect>=3.62.0",
"Adafruit-PlatformDetect>=3.70.1",
"Adafruit-PureIO>=1.1.7",
"binho-host-adapter>=0.1.6",
"pyftdi>=0.40.0",
"numpy>=1.21.5",
"adafruit-circuitpython-typing",
]
+ board_reqs,
+ board_reqs
+ platform_reqs,
license="MIT",
classifiers=[
# Trove classifiers
Expand Down
58 changes: 0 additions & 58 deletions src/adafruit_blinka/board/raspberrypi/raspi_5b.py

This file was deleted.

Empty file.
95 changes: 0 additions & 95 deletions src/adafruit_blinka/microcontroller/bcm2712/pin.py

This file was deleted.

3 changes: 1 addition & 2 deletions src/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@
or detector.board.RASPBERRY_PI_CM4
or detector.board.RASPBERRY_PI_CM4S
or detector.board.RASPBERRY_PI_400
or detector.board.RASPBERRY_PI_5
):
from adafruit_blinka.board.raspberrypi.raspi_4b import *
elif detector.board.RASPBERRY_PI_5:
from adafruit_blinka.board.raspberrypi.raspi_5b import *

elif detector.board.any_raspberry_pi_40_pin:
from adafruit_blinka.board.raspberrypi.raspi_40pin import *
Expand Down
3 changes: 1 addition & 2 deletions src/digitalio.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
"RASPBERRY_PI_400",
"RASPBERRY_PI_CM4",
"RASPBERRY_PI_CM4S",
"RASPBERRY_PI_5",
):
from adafruit_blinka.microcontroller.bcm2711.pin import *
elif board_id in ("RASPBERRY_PI_5",):
from adafruit_blinka.microcontroller.bcm2712.pin import *
else:
from adafruit_blinka.microcontroller.bcm283x.pin import Pin
elif detector.chip.AM33XX:
Expand Down
1 change: 1 addition & 0 deletions src/microcontroller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def delay_us(delay):
"RASPBERRY_PI_4B",
"RASPBERRY_PI_400",
"RASPBERRY_PI_CM4",
"RASPBERRY_PI_5",
]:
from adafruit_blinka.microcontroller.bcm2711 import *
else:
Expand Down
3 changes: 1 addition & 2 deletions src/microcontroller/pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
"RASPBERRY_PI_400",
"RASPBERRY_PI_CM4",
"RASPBERRY_PI_CM4S",
"RASPBERRY_PI_5",
):
from adafruit_blinka.microcontroller.bcm2711.pin import *
elif board_id in ("RASPBERRY_PI_5",):
from adafruit_blinka.microcontroller.bcm2712.pin import *
else:
from adafruit_blinka.microcontroller.bcm283x.pin import *
elif chip_id == ap_chip.DRA74X:
Expand Down

0 comments on commit a1329a8

Please sign in to comment.