cinderblock
Posts: 10
Joined: Fri Jul 15, 2016 1:08 am

List of GPIO libraries

Tue Apr 23, 2019 11:18 pm

Hello all.

I've been getting into using the GPIOs on Pis for arbitrary inputs/outputs. It's easy enough to get started following one of the many many tutorials.

Ignoring that there are a huge number of languages to choose from, within one language there are often many different libraries, each with different capabilities and styles. For instance using sysfs file system and letting linux take care of the translations. I suspect there is also a C API for controlling GPIOs on linux. Using `epoll` fits in there somewhere too. There are a bunch of other ways to control the GPIOs as well. For instance direct register manipulation via `/dev/gpiomem`. Other libraries use `/dev/mem` to access the PWM hardware registers. Some use the DMA hardware of the BCM SoC to achieve hardware like performance on arbitrary GPIO pins. Some libraries also wrap around I2C/SPI/Serial hardware or even bitbang those protocols on any GPIO.

I'm wondering if anyone has attempted to make a list of all the different (popular) GPIO libraries, their features, and internal techniques that are actually used. Anyone else think this could be valuable to the community?

User avatar
joan
Posts: 13925
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: List of GPIO libraries

Wed Apr 24, 2019 5:09 am

https://elinux.org/RPi_GPIO_Code_Samples addreses part of yourvquestion.

cinderblock
Posts: 10
Joined: Fri Jul 15, 2016 1:08 am

Re: List of GPIO libraries

Thu Apr 25, 2019 6:56 pm

Thanks for the pointer joan. That listed a few that I hadn't seen.

I took a stab at creating the list: https://docs.google.com/spreadsheets/d/ ... sp=sharing I'd love any comments or suggestions.

I spent a couple minutes on each and filled out the details that I found without too much trouble. This is still a work in progress and there are some inconsistencies in how the data is presented (arbitrary order. .NET/C#. API) but I think this is a helpful place to start. Please suggest any edits that you see fit. References are helpful.

I tried to focus on libraries that added functionality to established languages as opposed to languages that support GPIO manipulation directly. The primary criteria to get on the list was the ability to control GPIOs on a Raspberry Pi. Other peripheral access (PWM, Serial, etc) was not a requirement but I thought it would be helpful to call out if such extra features are supported.

One library seems to have two fundamentally different APIs and I decided to make that one two lines. Other libraries seem to have changed their methods over time and I've focused on the most recent implementations. It might make sense to add a legacy version but the primary goal here was to help people choose one of the many available options when starting a new project and focusing on the "state-of-the-art" seems in line with that.

Rabbit_Pi
Posts: 23
Joined: Fri Sep 23, 2016 3:03 am

Re: List of GPIO libraries

Sun Apr 28, 2019 12:15 am

I can give a few thats always overlooked.

pi_piper gem:
it was a cool little project but no longer works. wish they would of finished it.

rpi_gpio gem:
simular to the python lib for the pi's gpio, but works with ruby. I highly recommend this gem file. It works with any other language lib used and can even modify and manipulate them as well.

cinderblock
Posts: 10
Joined: Fri Jul 15, 2016 1:08 am

Re: List of GPIO libraries

Wed May 01, 2019 2:56 am

Thanks for the notes!

I'm hesitant to add libraries that are known to be broken. (If I have any on there that are, I'd be interested to know).

I did a quick search for `rpi_gpio gem` and found a couple things that you might be talking about. I'm not a Ruby person myself so I don't know the standards there. Would you be willing to collect a little more info about this gem and possibly even suggesting the edits directly on the shared Google sheet?

stevieb9
Posts: 14
Joined: Fri Jan 13, 2017 2:40 pm

Re: List of GPIO libraries

Thu May 30, 2019 9:15 pm

RPi::WiringPi

Complete and thorough, easy to use Perl distribution that also includes several sub modules for additional sensors, peripherals etc.

Return to “General programming discussion”