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...
This is the code to show thos 3 threads started by the new RPi.GPIO (lgpio) patch:
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...
This is the code to show thos 3 threads started by the new RPi.GPIO (lgpio) patch:
Code:
import time, threading, os, psutildef ShowAllThreads(): time.sleep(0.1) process = psutil.Process(os.getpid()) own_threads = [thread.native_id for thread in threading.enumerate()] print('----------------------------------------') for tinfo in process.threads(): owned = '[own]' if tinfo.id in own_threads else '[sys]' print(f"{owned} {tinfo.id}, User Time: {tinfo.user_time}, Sys Time: {tinfo.system_time}") print('----------------------------------------')ShowAllThreads()import RPi.GPIO as GPIOGPIO.setmode(GPIO.BCM)ShowAllThreads()
Statistics: Posted by Marus780 — Sat Sep 14, 2024 10:34 pm