I don't know if this is the best place to ask questions about the lgpio library, if not please let me know.
Anyway, I have an RPi4 and I need to read and write from the GPIOs. I've been looking into the lgpio library, but I've run into a problem. I have an audio card that uses the PCM interface on GPIOs 18, 19, 20 and 21. The driver switches these GPIOs into alternate mode 4.
I tried running the example "bench.c" from the lgpio archive, which toggles GPIO 21 as fast as possible and reports the speed. Not surprisingly, this kills my audio output. When I check the GPIO modes using a different application, GPIO 21 has been switched to mode 1. Although lgpio provides a function "lgGpioGetMode()" to get the mode, there is no function to set the mode, so I can't restore it to mode 4 when the program ends. I tried to restart the audio driver by deselecting and reselecting the audio output device, but that didn't work so I had to reboot.
Is there truly no way to set the GPIO mode from the lgpio library?
Anyway, I have an RPi4 and I need to read and write from the GPIOs. I've been looking into the lgpio library, but I've run into a problem. I have an audio card that uses the PCM interface on GPIOs 18, 19, 20 and 21. The driver switches these GPIOs into alternate mode 4.
I tried running the example "bench.c" from the lgpio archive, which toggles GPIO 21 as fast as possible and reports the speed. Not surprisingly, this kills my audio output. When I check the GPIO modes using a different application, GPIO 21 has been switched to mode 1. Although lgpio provides a function "lgGpioGetMode()" to get the mode, there is no function to set the mode, so I can't restore it to mode 4 when the program ends. I tried to restart the audio driver by deselecting and reselecting the audio output device, but that didn't work so I had to reboot.
Is there truly no way to set the GPIO mode from the lgpio library?
Statistics: Posted by allanwright — Thu Feb 01, 2024 2:40 am