ilusm.dev

gpio

GPIO pin control for embedded/RPi: read, write, PWM, interrupts.

Load with: use gpio

Quick example

use gpio

result = gpexp(10, "./example")
prn(result)

Functions

Functions

gpexp(pin, dir)

Performs the operation. Takes pin, dir.

gpunx(g)

Performs the operation. Takes g.

gprd(g)

Reads data. Takes g.

gpwr(g, val)

Writes data. Takes g, val.

gphi(g)

Performs the operation. Takes g.

gplo(g)

Performs the operation. Takes g.

gptog(g)

Performs the operation. Takes g.

gppwm(pin, freq, duty)

Performs the operation. Takes pin, freq, duty.

gppws(p)

Performs the operation. Takes p.

gppwd(p, duty)

Performs the operation. Takes p, duty.

gpirq(pin, edge, fn)

Performs the operation. Takes pin, edge, fn.

gpirx(irq)

Performs the operation. Takes irq.

gpi2c(bus)

Performs the operation. Takes bus.

gpi2r(i2c, addr, reg, n)

Performs the operation. Takes i2c, addr, reg, n.

gpi2w(i2c, addr, reg, data)

Performs the operation. Takes i2c, addr, reg, data.

gpi2c(i2c)

Performs the operation. Takes i2c.

gpspi(bus, cs)

Performs the operation. Takes bus, cs.

gpspx(spi, data)

Performs the operation. Takes spi, data.

gpspc(spi)

Performs the operation. Takes spi.

gpadc(ch)

Performs the operation. Takes ch.

Module aliases

These are the public-facing names you call with use gpio:

  • gpio.out(p)
  • gpio.inp(p)
  • gpio.free(g)
  • gpio.rd(g)
  • gpio.wr(g, v)
  • gpio.hi(g)
  • gpio.lo(g)
  • gpio.tog(g)
  • gpio.pwm(p, f, d)
  • gpio.irq(p, e, fn)
  • gpio.i2c(b)
  • gpio.spi(b, c)
  • gpio.adc(c)

Notes

  • GPIO control for embedded Linux (Raspberry Pi etc.).