joukos / PaperTTY

PaperTTY - Python module to render a TTY or VNC on e-ink
942 stars 101 forks source link

Gpiozero - rpi5 support? #116

Closed mcarr823 closed 8 months ago

mcarr823 commented 8 months ago

This PR creates an optional dependency on gpiozero as an alternative to RPi.GPIO. This is because RPi.GPIO hasn't been updated in almost 2 years and does not support the new memory mapping of the GPIO pins on the raspberry pi 5, whereas gpiozero does support the rpi5.

It has been added as an optional dependency, and it's been implemented as a shim of sorts so that most of the code can remain unchanged. If gpiozero is detected, it will be used. Otherwise it will default to rpi.gpio.

I've found no notable speed difference between the two. I've tested with it installed and uninstalled, both on a IT8951 panel and on a EPD3in7 panel, with a rpi3a and a rpi zero, and everything appears to be working correctly.

I have NOT tested with an rpi5 to confirm if this does indeed add rpi5 support to papertty, as I do not own a rpi5 currently.

If papertty has been installed via pip, then gpiozero can be installed by going into the venv and installing it. eg.

source papertty_venv/bin/activate
pip3 install gpiozero

When starting papertty it will tell you if it's running gpiozero or not.