rpi-lgpio is a compatibility shim that uses lgpio to provide a RPi.GPIO interface that allows older programs written for that library to migrate to lgpio. Not sure why that wouldn't be working for you.So far I succesfully used RPi.GPIO library to work with the GPIO ports of a Raspberry Pi 4. But after getting the latest Raspberry OS updates, RPi.GPIO is not working anymore. I get `Failed to add edge detection` error when I use `GPIO.add_event_detect`. I search the internet and they say there is nothing that can be done with RPi.GPIO, and I must install some `lgpio` library, some kind of patch, I don't understand what it is: https://pypi.org/project/rpi-lgpio/. I installed and it ruined my app... It launch 3 threads only for initializing the library, and one of them is doing continous work. Come on ! What the ... is that ?? It is really necessary to use 3 threads to monitor a GPIO pin ? Did you heard about hardware interrupts ? Isn't a shame for a beautiful device like Raspberry Pi to do software pin monitoring using pulling ?
I want to ask the creators of the Raspberry Pi, what is the official recommendation for working with the GPIO ports ? But I want something serious, not toys for beginers that expose classes like LEDs and Buttons... I want to program the raw hardware as I want, not just for leds and buttons. For example, I want to count impulses on a pin... or do some sort of custom comunication protocol... I can't belive that is so complicated to use some damn ports on a Raspberry Pi, which is supposed to be fun and joy...
As noted by Murph2000, gpiozero is what the Pi engineers suggest, with the lgpio as a backend. I also have issues with lgpio, and the author does not seem interested, so I have a hard time suggesting lgpio.
For Linux in general, not specifically for the Pi, the suggested Python solution is gpiod, the Python bindings for libgpiod - not to be confused with the gpiod apt package that contains the libgpiod command line tools. That is a low fat solution that allows you to access GPIO only functionality from userspace, so driving and monitoring pins, none of the other built-in pin functions that the Pi provides. You can install the latest version with `pip install gpiod`. Here are some examples of using it.
I'm not sure exactly what you mean by "I want to program the raw hardware as I want", but I'm not about to suggest you mess with the hardware registers directly on a Pi running Linux, as some of the older libraries do, as that is a bad idea for beginners, IMHO.
Statistics: Posted by warthog618 — Sun Sep 15, 2024 5:00 am