Open phylax2020 opened 8 months ago
I'm afraid this is one of those cases where there's very little I can do; rpi-lgpio is about as slim as I can make it in the form of pure Python.
I might try converting rpi-lgpio to a C module, but unfortunately it's unlikely I'm going to have time to tackle a major task like that for several months. Even then, it's never going to rival the speed of RPi.GPIO because that banged the hardware registers directly, and rpi-lgpio will always be talking to lgpio which will be talking to the kernel gpiochip device over ioctls, which will be banging hardware registers, but this time they're at the other end of a PCIe bus (on the Pi 5; on prior models they're still on the SoC).
I'll leave this open with a "help wanted" tag in case anyone else wants to give it a shot, but for now "this is as good as it's gonna get".
So far I haven't found any performance data compared to RPi.GPIO. With RPi.GPIO I had no problems with a Python script for the HX711 load cell controller with a Pi Zero 2W under Bookworm OS. After I replaced RPi.GPIO with rpi-lgpio, the script for reading out the data from the HX711 no longer worked. The reason for this is that the execution of the following Python command sequence is approximately 10 times slower:
RPi.GPIO requires an average of 15 microseconds. With rpi-lgpio, between 120 and 250 microseconds are required on average. This time period is too long, causing the HX711 controller to shut down during data transfer. This means that compatibility in terms of performance is not guaranteed.