gpio
allows access to a specific GPIO pin. The interface is restricted because it provides privileged access to GPIO hardware.
Auto-connect: no
Attributes:
-
number
(slot): GPIO pin number to export and expose to consuming snaps
To to use a gpio device, the snap developer must add plugs: [ gpio ]
to a snap’s snapcraft.yaml. The snap user can then access a specific gpio device with an interface connection.
Use snap interface gpio
to see which gpio devices are available on the system:
$ snap interface gpio
name: gpio
summary: allows access to specifc GPIO pin
slots:
- pi:bcm-gpio-0
- pi:bcm-gpio-1
- pi:bcm-gpio-10
[...]
Once connected, the consuming snap can use the device via /sys/class/gpio/gpioN
where N
is the pin number specified by the connected slot.
ⓘ This is a snap interface. See Interface management and Supported interfaces for further details on how interfaces are used.