Skip to content
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

Lgpio native #911

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Lgpio native #911

wants to merge 8 commits into from

Conversation

frank-pet
Copy link

@frank-pet frank-pet commented Nov 16, 2024

Code changes to remove use of RPi.GPIO and replace with using the lgpio package directly. changes to:

  1. microcontroller/bcm2711/pin.py
  2. microcontroller/bcm283x/pin.py
  3. microcontroller/bcm283x/pwmio/PWMOut.py

Changes have been tested and work on both a PI 5 and a Pi3b.

This is the fix for Issue #910

updates for lgpio-native changes
lgpio native changes
lgpio native changes
lgpio native changes
lgpio native changes
lgpio native changes
@makermelissa
Copy link
Collaborator

Overall, the changes in the PR look great and it appears you have done most of the hard stuff.

However, the bcm283x files are used by every single raspberry pi from Pi 1 through Pi 3B+ and I'd prefer to leave these alone as they seem to be fine. The bcm2811 files are used by Pi 4 and up and are probably safe to mess with. Because lgpio appears to be targeted more at linux and less at Raspberry Pis specifically, I would prefer to add new lgpio-specific pinfile to src/adafruit-blinka/microcontroller/generic_linux (something like lgpio_pin.py) so that they could be used by other boards in the future and maybe a copy of the PWMOut (with your changes) to the bcm2811 folder. Then only the bcm2811 files could just make use of those.

@makermelissa
Copy link
Collaborator

Also, if you wanted to test with the Raspberry Pi Zero (original), that would probably be pretty equivalent to the Original Raspberry Pi.

@frank-pet
Copy link
Author

Just finished testing on a Pi zero w v1.1. changes work just fine. Took some effort since all my other projects are 64-bit machines; had to build a 32 bit image for this test...

@makermelissa
Copy link
Collaborator

Thank you. The main odd thing in your code that I see is:
In PWMOut, rather than importing board, why not have:
from adafruit_blinka.microcontroller.bcm283x.pin import Pin, CHIP

And then you can remove the unused import from bcm2711.

I want to do some testing myself (such as speed tests) and if it is similar (or faster). I may do some restructuring as well so that other boards could use the lgpio pin def as well. It will at least allow us to have some consistency this way.

@frank-pet
Copy link
Author

frank-pet commented Feb 6, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants