Pirate Audio - how to test?

I have a Pi 4B that I have set up with MiniDexed with the latest bits from github.
It produced sound through the Pi 3.5 jack.

i just bought a Pirate audio Line Out hat.
I made the changes from the github topics to tweak the ini for the Pirate audio.
The audio works, the backlight turns on but nothing shows in the display. Without seeing the display I have to way to test the buttons, either.

I then burned a new OS card from the Raspberry Pi OS 32 bit image I just downloaded to see if I can test the hat from the OS.
Using the instructions from here, I can’t get python to install?

I don’t want to return the hat without testing it independently of the minidexed environment.

How should I test this?

Thank you.

To test the LCD you need to do the following. First install the python driver. It’s setup to install into a custom virtual enviromernt.
GitHub - pimoroni/st7789-python: Python library to control an ST7789 240x240 1.3" TFT LCD display.

git clone https://github.com/pimoroni/st7789-python
cd st7789-python
./install.sh

Then activate the custom virtual enviroment.
source ~/.virtualenvs/pimoroni/bin/activate

Then give this code a try.

#!/usr/bin/env python3

from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import time

import st7789


MESSAGE = "SPI0 CE1 240x240 LCD screen"

# Create ST7735 LCD display class.
disp = st7789.ST7789(
    height=240,
    width=240,    
    port=0,
    cs=1, 
    dc=9,
    backlight=13,
    rotation=90,
    spi_speed_hz=80 * 1000 * 1000,    
)

# Initialize display.
disp.begin()

WIDTH = disp.width
HEIGHT = disp.height


img = Image.new('RGB', (WIDTH, HEIGHT), color=(0, 0, 0))

draw = ImageDraw.Draw(img)

font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 30)

size_x, size_y = draw.textsize(MESSAGE, font)

text_x = disp.width
text_y = (disp.height - size_y) // 2

t_start = time.time()

while True:
    x = (time.time() - t_start) * 100
    x %= (size_x + 240)
    draw.rectangle((0, 0, disp.width, disp.height), (0, 0, 0))
    draw.text((int(text_x - x), text_y), MESSAGE, font=font, fill=(255, 255, 255))
    disp.display(img)

There is code here that I think could be used to test the buttons. The Display Hat Mini also has them. I’m going to try and have a go at it myself some time today, and post back how it goes.
st7789-python/examples/320x240.py at main · pimoroni/st7789-python · GitHub

This worked for me to test the buttons.

#!/usr/bin/env python3

from gpiozero import Button
from signal import pause

print("""Pirate Audio Hat: buttons.py

Demonstrates the use of the Pirate Audio Hat buttons with gpiozero.

Press Ctrl+C to exit!

""")


def pressed(button):
    button_name = button_map[button.pin.number]
    print(f"Button {button_name} pressed!")


button_map = {5: "A",
              6: "B",
              16: "X",
              24: "Y"}

button_a = Button(5)
button_b = Button(6)
button_x = Button(16)
button_y = Button(24)

try:
    button_a.when_pressed = pressed
    button_b.when_pressed = pressed
    button_x.when_pressed = pressed
    button_y.when_pressed = pressed

    pause()

except KeyboardInterrupt:
    button_a.close()
    button_b.close()
    button_x.close()
    button_y.close()