View Source Circuits.GPIO.Handle protocol (circuits_gpio v2.0.0-pre.0)
A handle is the connection to a real or virtual GPIO controller, bank, or pin
Link to this section Summary
Functions
Free up resources associated with the handle
Return the current GPIO state
Change the direction of the GPIO
Change the pull mode of an input GPIO
Set the GPIO state
Link to this section Types
@type info() :: %{pin_spec: Circuits.GPIO.pin_spec()}
@type t() :: term()
Link to this section Functions
@spec close(t()) :: :ok
Free up resources associated with the handle
Well behaved backends free up their resources with the help of the Erlang garbage collector. However, it is good
practice for users to call Circuits.GPIO.close/1
(and hence this function) so that
limited resources are freed before they're needed again.
@spec read(t()) :: Circuits.GPIO.value()
Return the current GPIO state
@spec set_direction(t(), Circuits.GPIO.pin_direction()) :: :ok | {:error, atom()}
Change the direction of the GPIO
@spec set_interrupts(t(), Circuits.GPIO.trigger(), Circuits.GPIO.interrupt_options()) :: :ok | {:error, atom()}
@spec set_pull_mode(t(), Circuits.GPIO.pull_mode()) :: :ok | {:error, atom()}
Change the pull mode of an input GPIO
@spec write(t(), Circuits.GPIO.value()) :: :ok
Set the GPIO state