Home Documentation Tutorials API GitHub

Spi

The Spi API allows you to communicate over serial SPI interfaces.

Basics

Invoke Spi.open to open a SPI interface with a given SpiConfig. Transfer and receive data using the transfer method:

spi  := Spi.open("spidev1.0", SpiConfig {})
data := Buf().writeI4(0x1234_abcd)
resp := spi.transfer(data)
spi.close

Once you are finished with a port, call close to free the backing native process.