View Source Wafer.Driver.Circuits.GPIO (wafer v1.1.0)

A connection to a native GPIO pin via Circuits' GPIO driver.

Implements the Wafer.Conn behaviour as well as the Wafer.GPIO protocol.

Summary

Functions

Acquire a connection to a native GPIO pin via Circuit's GPIO driver.

Types

@type option() :: {:pin, non_neg_integer()} | {:direction, Wafer.GPIO.pin_direction()}
@type options() :: [option()]
@type t() :: %Wafer.Driver.Circuits.GPIO{
  direction: Wafer.GPIO.pin_direction(),
  pin: non_neg_integer(),
  ref: reference()
}

Functions

@spec acquire(options()) :: {:ok, t()} | {:error, reason :: any()}

Acquire a connection to a native GPIO pin via Circuit's GPIO driver.

Options

  • :pin (required) the integer number of the pin to connect to. Hardware dependent.
  • :direction (optional) either :in or :out. Defaults to :out.