{ } qjs-modules

gpio

Source: quickjs-gpio.c — module export: GPIO

Reads and drives GPIO pins (Linux memory-mapped GPIO).

Constructor

new GPIO()   // length 1

Methods

MethodArgsDescription
initPin(pin, mode)2Configures pin as GPIO.INPUT or GPIO.OUTPUT.
setPin(pin, value)2Drives an output pin to GPIO.LOW/GPIO.HIGH.
getPin(pin)1Reads the current level of pin.

Properties (read-only)

PropertyDescription
bufferThe underlying register buffer.
[Symbol.toStringTag]"GPIO".

Static constants

INPUT (0), OUTPUT (1), LOW (0), HIGH (1).