| 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_INPUTgpio.PIN_OUTPUTgpio.PIN_INOUTgpio.PIN_OPENDRAINgpio.PIN_PUSHPULLgpio.PIN_TRISTATEgpio.PIN_PULLUPgpio.PIN_PULLDOWNgpio.PIN_INVINgpio.PIN_INVOUTgpio.PIN_USERgpio.PIN_PULSATEgpio.PIN_SETgpio.unset(gpiodev,
pin)stat
= gpio.read(gpiodev, pin)oldstate
= gpio.write(gpiodev, pin, state)gpio.PIN_LOWgpio.PIN_HIGHgpio.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 8.99 |