Thank you, warthog618, for clarifying things.libgpiod is the standard library for driving GPIOs via the GPIO character device, /dev/gpiochipN, which is the standard GPIO userspace interface for Linux.
That interface is the only one that works on all Pi variants. Other libraries that use the obsolete sysfs interface or the /dev/gpiomem interface will not work on the Pi5.
libgpiod v2 can do anything that is possible via that interface.
Then you should use libgpiod v2. That is the latest version and replaces the less versatile libgpiod v1 which has a different API and is now a dead-end.
It provides both C and Python bindings (and C++ and Rust too), and includes examples for common use cases in all of the languages it supports.
Last I heard it was not packaged for Pi OS - the available packages are libgpiod v1 (yes even the libgpiod2 package), so you would need to install it from source. They are planning to package v2 for Pi OS, but I don't think they are there yet.
Using assembly for GPIO on the Pi5 doesn't make sense to me.
I think one should avoid using assembly language. I'm saying this as one who had a five-decade career writing mostly assembly language code. But the point of my book is to show what's going on at the machine level. For example, I give a programming construct, say a while loop, in C and then show what it looks like in assembly language.
I'm trying to keep things simple for beginners, so I'll probably have to stay with libgpiod v1. I maintain a companion website, so when RPi OS moves to v2, I can post upgrades there.
Statistics: Posted by rplantz — Sat Mar 16, 2024 3:55 pm