Open maruel opened 9 months ago
I failed to find proper documentation. Sadly, there's zero reference to PWM in libgpiod.
@maruel I've looked over the linked ticket, but don't understand what's yet to be done. If you could give me some idea of what's needed, I could give it a go.
@gsexton In periph.io/x/host/v3/sysfs, the function driverGPIO.Init()
opens the directories in /sys/class/gpio/gpiochip*
. This needs to be changed to use /sys/bus/gpiochip*
. There's more to it than just the discovery since the way to access each gpio is a bit different.
Copying from the original issue:
It's the "new" GPIO API for linux kernels above 4.8, based on ioctl on a single handle instead of having to open multiple handles. Now [in 2019] that devices are using later kernels (Raspbian is on 4.14), periph should enable the use of this interface when available, and fallback with the current code on older kernels.
The primary rationale is that it enables pull resistors via the constants
GPIOLINE_FLAG_OPEN_DRAIN
andGPIOLINE_FLAG_OPEN_SOURCE
. It also enables support for reading and writing multiple lines at once. This would have many uses but the periph gpio API currently doesn't make this use-case easy to implement, so multi-pin synchronized I/O requires more thoughts.
Refs:
Ported from https://github.com/google/periph/issues/371
It's the "new" GPIO API for linux kernels above 4.8, based on ioctl on a single handle instead of having to open multiple handles. There isn't a need to support older kernels anymore so we should just switch over.