ElixirALE.GPIO likes it's pin directions to end with "put".
This commit is contained in:
parent
1c1ee39fea
commit
54a98adbb5
2 changed files with 2 additions and 1 deletions
|
@ -28,6 +28,7 @@ defmodule Wafer.Driver.ElixirALE.GPIO do
|
|||
def acquire(opts) when is_list(opts) do
|
||||
with {:ok, pin} when is_pin_number(pin) <- Keyword.fetch(opts, :pin),
|
||||
direction when direction in [:in, :out] <- Keyword.get(opts, :direction, :out),
|
||||
direction <- String.to_atom("#{direction}put"),
|
||||
{:ok, pid} <- Wrapper.start_link(pin, direction, Keyword.drop(opts, ~w[pin direction]a)) do
|
||||
{:ok, %__MODULE__{pid: pid, pin: pin, direction: direction}}
|
||||
else
|
||||
|
|
|
@ -13,7 +13,7 @@ defmodule WaferDriverElixirALE.GPIOTest do
|
|||
Wrapper
|
||||
|> expect(:start_link, 1, fn pin, direction, opts ->
|
||||
assert pin == 1
|
||||
assert direction == :out
|
||||
assert direction == :output
|
||||
assert opts == []
|
||||
{:ok, self()}
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue