C/C++ GPIO library

I setup a raspberry pi long ago with Geany using C language on whatever Linux was recommended (Ubuntu maybe) . I had a specific library I needed to install and link to get GPIO working. I don’t see any basic setup for GPIO using C, so I’m skeptical to purchase some boards. I don’t want to use Python either.

Upstream Linux has moved to libgpiod. This is maintained by Bartosz and the userspace tools are also maintained by him. For the mappings, you can either use libretech-wiring-tool to lookup the chip and line numbers or the precompiled GPIO maps.

For C or C++ bindings, you can find them here: libgpiod/bindings/cxx at master · brgl/libgpiod · GitHub

You can find the packaged library (libgpiod or libgpiod2) included in most Linux distributions.

3 Likes