elixir_ale v0.6.0 ElixirALE.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
Types
spi_option()
spi_option :: {:mode, 0..3} | {:bits_per_word, 0..16} | {:speed_hz, pos_integer} | {:delay_us, non_neg_integer}
Functions
start_link(devname, spi_opts \\ [], opts \\ [])
start_link(binary, [spi_option], [term]) :: {:ok, pid}
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 transaction (10)
Parameters:
devname
is the Linux device name for the bus (e.g., “spidev0.0”)spi_opts
is a keyword list to configure the busopts
are any options to pass to GenServer.start_link