-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
complete set of changes for RPi 5 #278
base: main
Are you sure you want to change the base?
Conversation
replace rpi.gpio by rpi_gpio_bridge
Create rpi_gpio_bridge.py to replace rpi.gpio
@outdoorbits |
You are welcome. I installed gpiozero by apt as mentioned at https://gpiozero.readthedocs.io/en/latest/installing.html |
@outdoorbits Yeah I understand that, but when the tests run, I suspect that the setup needs to be made aware of the necessary packages for it to function correctly. I opened a PR for your fork |
Added setup requirements
@rm-hull ... |
Looks like some test failures need investigating |
I recently opened issue #283. However, this was quite pointlessly marked as a duplicate with #270 and was even renamed similarly.
I tried to make the necessary modifications and I already have a working version! But I don't know if anyone is interested in my solution. I don't intend to do a PR (as was the case with adding the sh1107 display to the luma.oled library, maybe thijstriemstra will remember). If you are interested, let me know how to get it to you. |
@Pako2 Hey there, yeah I'm definitely interested in anything that works with a RPi5. |
@RampantDespair OK, so here it is. I am aware that my solution probably contains some bugs as the testing was only very superficial.
It should also be noted that my "3" version has a limitation compared to the original version - it does not allow using non-HW pins as CE. This is given by the lgpio implementation of SPI. I'm very interested in testing with the RPi5. Please let me know the results! |
I’ll try and get back into the headspace again to look into this. I’d like to make sure it doesn’t break for existing users, or if it does we can try and manage expectations by publishing a major version. The tldr is to use a more modern GPIO library, right? |
@rm-hull In the attached file, this is already solved by adding the "board" parameter. If this parameter is omitted (or set to False), BCM mode (native to lgpio) is used. If True, BOARD mode is used. luma.core-lgpio-2.zip |
The decision seems to have been made to replace RPi.GPIO with lgpio. In my tests, this has worked without any problems so far. However, I would like to point out that it can lead to unpredictable complications in existing projects if lgpio does not behave 100% like RPi.GPIO. We all know that such a match is virtually impossible. gpiozero, on the other hand, can be installed from the debian repository since buster and is one of the packages installed by default (at least in bookworm). Replacing RPi.GPIO with lgpio could be a serious intervention in the system. Switching to gpiozero would avoid the risk of the complications mentioned above and presumably increase stability. |
@outdoorbits I don't really understand your objections to lgpio. According to my information, gpiozero depends on lgpio and doesn't work without it. So it is illogical that switching to gpiozero could somehow increase stability compared to a solution that omits gpiozero. |
It's just because you have to remove RPi.GPIO and this looks like a bigger change to the system than keeping such a central package untouched. |
I am not sure that your steps are not hasty. I do not yet see that @rm-hull or @thijstriemstra is preparing to switch to lgpio in the near future. And in the more distant future, anything is possible, for example, that some other solution will appear. |
I am sorry that I will answer to myself. But what to do when no one else is discussing here and I feel it's important to add some additional comments. However, while testing luma.core and luma.oled on the Orange Pi Zero 2 board, I realized that the modifications to the "serial.py" module I suggested last time still need some work.
Obtaining the chip number Getting the gpio number from the physical pin number As a solution to both problems, I introduced a new "model" parameter. However, the database of individual SBC models must become part of the luma.core library. The database contains both a conversion table and a chip number for each model. The database is in the "sbc.py" module. So far (for testing) it only includes RPi4, RPi5 and Orange Pi Zero 2 boards. The "sbc.py" module needs to be placed in the root of the luma.core library (like "device.py" for example). In the attachment there are again two alternatives of the "serial.py" module. ATTENTION, this time I tested with an Orange Pi Zero 2 board (DC is connected to pin 13 and RST is connected to pin 11) and the test programs match this! I am asking for comments on my post ! |
This is the complete change as I use it in https://github.com/outdoorbits/little-backup-box.