I’ve just created some gpiod examples in both C and python. You can get to them via:
bone$ cd /var/lib/cloud9
bone$ git pull
bone$ git checkout v2020.08
bone$ cd BeagleBone/Black/gpiod
bone$ sudo apt update; sudo apt install libgpiod-dev
Here’s the ReadMe.md
One of the advantages of gpiod is that it can toggle multiple bits on the same gpio chip at the same time. The toggle2 examples show how it’s done.
The directory contains examples of using gpiod with C and python to read/write a gpio pin.
Toggles one pin as fast as possible. (300KHz in C, 57KHz in python)
Toggles two pins as fast as possible. (280KHz in C, 55KHz in python)
Reads an input pin and prints its value.
Reads an input pin and writes its value to an output pin. (5us delay in C, 20 us Delay in python)
Like getset, but uses events. (40 us delay in C, 75 us delay in python)
Toggles the four built in USR LEDs.
Tip: Use gpioinfo to lookup chip and line numbers for various pins.
Feedback is welcome.