elixir_ale v0.6.0 ElixirALE.GPIO

This is an Elixir interface to Linux GPIOs. Each GPIO is an independent GenServer.

Summary

Functions

Read the current value of the pin

Free the resources associated with pin and stop the GenServer

Turn on “interrupts” on the input pin. The pin can be monitored for :rising transitions, :falling transitions, or :both. The process that calls this method will receive the messages

Start and link a new GPIO GenServer. pin should be a valid GPIO pin number on the system and pin_direction should be :input or :output

Write the specified value to the GPIO. The GPIO should be configured as an output. Valid values are 0 or false for logic low and 1 or true for logic high. Other non-zero values will result in logic high being output

Types

int_direction()
int_direction() :: :rising | :falling | :both
pin_direction()
pin_direction() :: :input | :output

Functions

read(pid)
read(pid) :: :ok | {:error, term}

Read the current value of the pin.

release(pid)
release(pid) :: :ok

Free the resources associated with pin and stop the GenServer.

set_int(pid, direction)
set_int(pid, int_direction) :: :ok | {:error, term}

Turn on “interrupts” on the input pin. The pin can be monitored for :rising transitions, :falling transitions, or :both. The process that calls this method will receive the messages.

start_link(pin, pin_direction, opts \\ [])
start_link(integer, pin_direction, [term]) :: {:ok, pid}

Start and link a new GPIO GenServer. pin should be a valid GPIO pin number on the system and pin_direction should be :input or :output.

write(pid, value)
write(pid, 0 | 1 | true | false) :: :ok | {:error, term}

Write the specified value to the GPIO. The GPIO should be configured as an output. Valid values are 0 or false for logic low and 1 or true for logic high. Other non-zero values will result in logic high being output.