trejan wrote: ↑
Tue Nov 26, 2019 3:04 pm
john77 wrote: ↑
Tue Nov 26, 2019 2:37 pm
Do you mean gpiod_chip_get_line(chip, X
); = GPIOX
Yes. They're labelled as BCM X on https://pinout.xyz
That's how it currently is on Raspbian but "gpiod" is I believe intended to be a virtualisation and abstraction of the hardware so the mapping could be anything.
The intention AIUI is to provide a means that a user program can run on any platform or board without change. For example, Set("AlarmBell") should work on any board regardless of what that board is or which pin an alarm bell might be connected to, Set("ActivityLed") should light that up on any Pi no matter whether it is controlled by a GPIO pin directly or through a separate I/O expander chip, whether active high or active low.
It's similar to how "/dev/serial0" on a Pi is mapped to "/dev/ttyAMA0" or "/dev/ttyS0". The user doesn't need to care which it is providing they use "/dev/serial0".
But, whether "gpiod" is actually usable or fit for purpose is however questionable IMO.
Notionally one should not be using a number or anything board specific to access a particular pin but, in practical terms, that's exactly how things are currently done, how we expect to do it.
The current Pi implementation doesn't even name most of the "gpiod" pins and giving them "GPIO0"-"GPIO53" names defeats the abstraction intended. The "gpiod" system isn't even 'live'; doesn't recognise that some program has taken control of a pin if it does that directly, through RPi.GPIO or WiringPi etc.
Thus "gpiod" may be the recommended way, may be the future, but I looked at it and decided it wasn't yet fit for 'prime time', have ignored it since.