View Source Circuits.GPIO.Backend behaviour (circuits_gpio v2.0.0-pre.0)

Backends provide the connection to the real or virtual GPIO controllers

Link to this section Summary

Callbacks

Return information about this backend

Open one or more GPIOs

Link to this section Callbacks

@callback info() :: map()

Return information about this backend

Link to this callback

open(pin_spec, direction, options)

View Source
@callback open(
  pin_spec :: Circuits.GPIO.pin_spec(),
  direction :: Circuits.GPIO.pin_direction(),
  options :: Circuits.GPIO.open_options()
) :: {:ok, Circuits.GPIO.Handle.t()} | {:error, atom()}

Open one or more GPIOs

pin_spec should be a valid GPIO pin specification on the system and direction should be :input or :output. If opening as an output, then be sure to set the :initial_value option if you need the set to be glitch free.

Options:

  • :initial_value - Set to :not_set, 0 or 1 if this is an output. :not_set is the default.
  • :pull_mode - Set to :not_set, :pullup, :pulldown, or :none for an input pin. :not_set is the default.