#gpiosysfs cheatsheet
Every export of @skiffyard/gpiosysfs. The pin numbering and the sysfs root are in the introduction.
jenniferimport "@skiffyard/gpiosysfs/" as gpiosysfs;
#Pins
| Function | Returns | Does |
|---|
gpiosysfs.setup(pin as int, direction as string) | null | Export pin (unless exported) and set its direction; an output starts low |
gpiosysfs.write(pin as int, value as int) | null | Set an output pin to 0 or 1 |
gpiosysfs.read(pin as int) | int | The pin's value, 0 or 1 |
gpiosysfs.release(pin as int) | null | Unexport pin |
gpiosysfs.useChip(label as string) | null | Select the chip pin numbers refer to: AUTO, GLOBAL or a chip label |
#Constants
| Name | Value | Meaning |
|---|
IN | "in" | Direction input, for setup |
OUT | "out" | Direction output, for setup |
AUTO | "" | useChip: the Raspberry Pi header chip, by label (the default) |
GLOBAL | "global" | useChip: pin numbers are sysfs global numbers |
#Environment
| Variable | Default | Meaning |
|---|
JENNIFER_GPIO_BASE | /sys/class/gpio | The sysfs GPIO root |
JENNIFER_GPIO_CHIP_LABEL | empty (AUTO) | The chip selection useChip writes |