Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4475

General discussion • RPi 5 gpio libraries

$
0
0
There are several posts about gpio access from C, however, they tend to be out of date for the RPi 5. Many of the libraries are provided by third parties that do not support them anymore. With the changes in the architecture with RPi 5 these have become obsolete. What I am after is a very simple interface to read the status of a number of gpio pins. There is the utility pinctrl which comes from the RPi repository so I have some hope it will be maintained going forward. I can use this but only through the cli interface. Writing in Java:

Runtime rt = Runtime.getRuntime();
Process p=rt.exec(“pinctrl set 4 ip pd”);
p.waitFor();
p=rt.exec(“pinctrl get 4”);

This returns a string containing lo or hi from which I can determine the state of the pin. I see from the code for pinctrl that there is a library to support it. My question is whether or not i should program directly with the library (using Java JNA) or should i use the cli interface which I find cumbersome.

Any thoughts.

Statistics: Posted by Mikerb999 — Mon Jul 15, 2024 12:48 pm — Replies 1 — Views 30



Viewing all articles
Browse latest Browse all 4475

Trending Articles