Circuits.GPIO.set_interrupts

You're seeing just the function set_interrupts, go back to Circuits.GPIO module for more information.
Link to this function

set_interrupts(gpio, trigger, opts \\ [])

View Source

Specs

set_interrupts(reference(), trigger(), list()) :: :ok | {:error, atom()}

Enable or disable pin value change notifications. The notifications are sent based on the trigger parameter:

  • :none - No notifications are sent
  • :rising - Send a notification when the pin changes from 0 to 1
  • :falling - Send a notification when the pin changes from 1 to 0
  • :both - Send a notification on all changes

Available Options:

  • suppress_glitches - It is possible that the pin transitions to a value and back by the time that Circuits GPIO gets to process it. This controls whether a notification is sent. Set this to false to receive notifications.
  • receiver - Process which should receive the notifications. Defaults to the calling process (self())

Notifications look like:

{:circuits_gpio, pin_number, timestamp, value}

Where pin_number is the pin that changed values, timestamp is roughly when the transition occurred in nanoseconds since host system boot time, and value is the new value.

NOTE: You will need to store the Circuits.GPIO reference somewhere (like your GenServer's state) so that it doesn't get garbage collected. Event messages stop when it gets collected. If you only get one message and you are expecting more, this is likely the case.