Skip to content

Commit fc4b4bd

Browse files
authored
Merge pull request #9 from pimoroni/feature/pi5
Bookworm/Pi5 Compatibility: Upgrade to latest boilerplate
2 parents e5bc06b + 198423b commit fc4b4bd

File tree

12 files changed

+289
-125
lines changed

12 files changed

+289
-125
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
1.0.0
2+
-----
3+
4+
* Port to gpiod/gpiodevice for Pi 5
5+
* Use dummy LEDs for Pi 5
6+
17
0.0.1
28
-----
39

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ endif
2222
@echo "deploy: build and upload to PyPi"
2323
@echo "tag: tag the repository with the current version\n"
2424

25+
version:
26+
@hatch version
27+
2528
install:
2629
./install.sh --unstable
2730

@@ -30,11 +33,14 @@ uninstall:
3033

3134
dev-deps:
3235
python3 -m pip install -r requirements-dev.txt
33-
sudo apt install dos2unix
36+
sudo apt install dos2unix shellcheck
3437

3538
check:
3639
@bash check.sh
3740

41+
shellcheck:
42+
shellcheck *.sh
43+
3844
qa:
3945
tox -e qa
4046

@@ -44,7 +50,7 @@ pytest:
4450
nopost:
4551
@bash check.sh --nopost
4652

47-
tag:
53+
tag: version
4854
git tag -a "v${LIBRARY_VERSION}" -m "Version ${LIBRARY_VERSION}"
4955

5056
build: check
@@ -54,7 +60,7 @@ clean:
5460
-rm -r dist
5561

5662
testdeploy: build
57-
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
63+
twine upload --repository testpypi dist/*
5864

5965
deploy: nopost build
6066
twine upload dist/*

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Reboot after this for the change to take effect.
6161

6262
To use the audio output of your Inventor HAT Mini you will need to modifying your Pi's configuration file. To do this run `sudo nano /boot/config.txt` to open a terminal text editor.
6363

64-
Within the editor navigate to the bottom of the file and include the lines `dtoverlay=hifiberry-dac` and `gpio=25=op,dh`. The first line switches the audio to use the GPIO header of your Pi for audio output, and the second line will cause your Pi to enable the audio output on bootup, by setting pin BCM 25 to high. Then navigate up to the line `dtparam=i2s=on`. If this says `off` or is commented out with a `#`, uncomment it and change it to `on`.
64+
Within the editor navigate to the bottom of the file and include the lines `dtoverlay=hifiberry-dac` and `gpio=25=op,dh`. The first line switches the audio to use the GPIO header of your Pi for audio output, and the second line will cause your Pi to enable the audio output on boot, by setting pin BCM 25 to high. Then navigate up to the line `dtparam=i2s=on`. If this says `off` or is commented out with a `#`, uncomment it and change it to `on`.
6565

6666
Depending on your setup, you may also need to disable other audio outputs of your Pi (for example audio over HDMI). Look through the file for any existing mention to `dtparam=audio=on` and change it to `dtparam=audio=off`. There may the line `dtoverlay=vc4-kms-v3d`. Modify this to be `dtoverlay=vc4-kms-v3d,noaudio`.
6767

check.sh

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
# This script handles some basic QA checks on the source
44

55
NOPOST=$1
6-
LIBRARY_NAME=`hatch project metadata name`
7-
LIBRARY_VERSION=`hatch version | awk -F "." '{print $1"."$2"."$3}'`
8-
POST_VERSION=`hatch version | awk -F "." '{print substr($4,0,length($4))}'`
6+
LIBRARY_NAME=$(hatch project metadata name)
7+
LIBRARY_VERSION=$(hatch version | awk -F "." '{print $1"."$2"."$3}')
8+
POST_VERSION=$(hatch version | awk -F "." '{print substr($4,0,length($4))}')
9+
TERM=${TERM:="xterm-256color"}
910

1011
success() {
1112
echo -e "$(tput setaf 2)$1$(tput sgr0)"
@@ -28,7 +29,7 @@ while [[ $# -gt 0 ]]; do
2829
;;
2930
*)
3031
if [[ $1 == -* ]]; then
31-
printf "Unrecognised option: $1\n";
32+
printf "Unrecognised option: %s\n" "$1";
3233
exit 1
3334
fi
3435
POSITIONAL_ARGS+=("$1")
@@ -39,8 +40,7 @@ done
3940
inform "Checking $LIBRARY_NAME $LIBRARY_VERSION\n"
4041

4142
inform "Checking for trailing whitespace..."
42-
grep -IUrn --color "[[:blank:]]$" --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO
43-
if [[ $? -eq 0 ]]; then
43+
if grep -IUrn --color "[[:blank:]]$" --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO; then
4444
warning "Trailing whitespace found!"
4545
exit 1
4646
else
@@ -49,8 +49,7 @@ fi
4949
printf "\n"
5050

5151
inform "Checking for DOS line-endings..."
52-
grep -lIUrn --color $'\r' --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile
53-
if [[ $? -eq 0 ]]; then
52+
if grep -lIUrn --color $'\r' --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile; then
5453
warning "DOS line-endings found!"
5554
exit 1
5655
else
@@ -59,8 +58,7 @@ fi
5958
printf "\n"
6059

6160
inform "Checking CHANGELOG.md..."
62-
cat CHANGELOG.md | grep ^${LIBRARY_VERSION} > /dev/null 2>&1
63-
if [[ $? -eq 1 ]]; then
61+
if ! grep "^${LIBRARY_VERSION}" CHANGELOG.md > /dev/null 2>&1; then
6462
warning "Changes missing for version ${LIBRARY_VERSION}! Please update CHANGELOG.md."
6563
exit 1
6664
else
@@ -69,8 +67,7 @@ fi
6967
printf "\n"
7068

7169
inform "Checking for git tag ${LIBRARY_VERSION}..."
72-
git tag -l | grep -E "${LIBRARY_VERSION}$"
73-
if [[ $? -eq 1 ]]; then
70+
if ! git tag -l | grep -E "${LIBRARY_VERSION}$"; then
7471
warning "Missing git tag for version ${LIBRARY_VERSION}"
7572
fi
7673
printf "\n"

0 commit comments

Comments
 (0)