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

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 info(t()) :: info()
@spec read(t()) :: Circuits.GPIO.value()

Return the current GPIO state

Link to this function

set_direction(handle, pin_direction)

View Source
@spec set_direction(t(), Circuits.GPIO.pin_direction()) :: :ok | {:error, atom()}

Change the direction of the GPIO

Link to this function

set_interrupts(handle, trigger, options)

View Source
@spec set_interrupts(t(), Circuits.GPIO.trigger(), Circuits.GPIO.interrupt_options()) ::
  :ok | {:error, atom()}
Link to this function

set_pull_mode(handle, mode)

View Source
@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