classstuds::Gpio
sys::Obj studs::Gpio
Gpio provides high level access to GPIO pins through the Linux /sys/class/gpio interface.
See Gpio chapter for details.
- close
Void close()Close this port.
- listen
Void listen(Str mode, |Int callback)Register an interrupt handler to listen for GPIO output changes. The
modeshould be one of the strings "rising", "falling" or "both" to indicate which edge(s) the ISR is to be triggered on. Invoke the given callback function when a change occurs. This method will block listening until close is called.- open
static Gpio open(Int pin, Str dir)Open a GPIO port with given pin and direction, where
diris"in"or"out".- read
Int read()Read the current value of the pin.
- write
Write the given value to the GPIO. The GPIO should be configured as an output. Valid values are
0for logic low, or1for logic high. Other non-zero values will result in logic high being output. Returns this.