GPIO(3lua) | LUA Library Manual | GPIO(3lua) |
gpio
—
local gpio = require 'gpio'
gpio
Lua binding provides access to a
gpio(4) device using the
ioctl(2) interface.
gpiodev
= gpio.open(path)
pins
= gpio.info(gpiodev)
gpio.close(gpiodev)
gpio.set(gpiodev,
pin, flags)
gpio.PIN_INPUT
gpio.PIN_OUTPUT
gpio.PIN_INOUT
gpio.PIN_OPENDRAIN
gpio.PIN_PUSHPULL
gpio.PIN_TRISTATE
gpio.PIN_PULLUP
gpio.PIN_PULLDOWN
gpio.PIN_INVIN
gpio.PIN_INVOUT
gpio.PIN_USER
gpio.PIN_PULSATE
gpio.PIN_SET
gpio.unset(gpiodev,
pin)
stat
= gpio.read(gpiodev, pin)
oldstate
= gpio.write(gpiodev, pin, state)
gpio.PIN_LOW
gpio.PIN_HIGH
gpio.toggle(gpiodev,
pin)
gpio.attach(gpiodev,
driver, offset, mask [, flags])
local gpio = require 'gpio' gpiodev = gpio.open('/dev/gpio0') local npins = gpiodev:info() for n = 1, npins do print('pin ' .. n .. ': ' .. gpiodev:read(n - 1)) end
gpio
manual appeared in NetBSD
7.0.
gpio
Lua binding was written by
Marc Balmer
<mbalmer@NetBSD.org>.
January 7, 2014 | NetBSD 9.4 |