elixir_ale v0.5.4 Spi

This module enables Elixir programs to interact with hardware that’s connected via a SPI bus.

Summary

Functions

Stop the GenServer and release the SPI resources

Start and link a SPI GenServer

Perform a SPI transfer. The data should be a binary containing the bytes to send. Since SPI transfers simultaneously send and receive, the return value will be a binary of the same length

Functions

release(pid)

Stop the GenServer and release the SPI resources.

start_link(devname, spi_opts \\ [], opts \\ [])

Start and link a SPI GenServer.

SPI bus options include: mode: This specifies the clock polarity and phase to use. (0) bits_per_word: bits per word on the bus (8) speed_hz: bus speed (1000000) delay_us: delay between transations (10)

Parameters: devname is the Linux device name for the bus (e.g., “spidev0.0”) spi_opts is a keyword list to configure the bus opts are any options to pass to GenServer.start_link

transfer(pid, data)

Perform a SPI transfer. The data should be a binary containing the bytes to send. Since SPI transfers simultaneously send and receive, the return value will be a binary of the same length.