gpio_rpi v0.2.0 GpioRpi
This is an Elixir interface to Raspberry PI 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
Set the input/output direction of the pin.
Additionally allows setting :mode
and `:interrupt’
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
Changes the pullup register to :none
, :down
, or :up
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
.
Optional parameters:
:mode
set pullup register, see set_mode/2.
:interrupt
, enable interrupts, see set_int/2 for the different transitions
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 :: :rising | :falling | :both
pin_direction :: :input | :output
pullup_mode :: :none | :down | :up
Functions
Specs
release(pid) :: :ok
Free the resources associated with pin and stop the GenServer.
Specs
set_direction(pid, pin_direction, [term]) ::
:ok |
{:error, term}
Set the input/output direction of the pin.
Additionally allows setting :mode
and `:interrupt’
Specs
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.
Specs
set_mode(pid, pullup_mode) :: :ok | {:error, term}
Changes the pullup register to :none
, :down
, or :up
.
Specs
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
.
Optional parameters:
:mode
set pullup register, see set_mode/2.
:interrupt
, enable interrupts, see set_int/2 for the different transitions.