exred_node_gpio_in v0.2.0 Exred.Node.GPIOIn

Receives data from a GPIO pin.

Uses Elixir ALE to interface with GPIO.

It can work in two modes:

  • ‘monitor’: monitors the pin and sends a message on pin interrupt
  • ‘read_on_message’: reads the pin state and sends the data when triggered by an incoming message

Incoming message format
Anything

Outgoing message format

read on message mode:

msg = %{
  payload :: 0 | 1
}

monitor mode:

msg = %{
  payload :: %{
    pin_number :: integer,
    condition  :: :rising | :falling
  }
}

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor

daemon_child_specs/1 needs to return a list of child specs. These child processes will be started under the DaemonNodeSupervisor

handle_msg/2 is called whenever the node receives a message from another node. It should return an {outgoing_msg, new_state} tuple

Link to this section Functions

Link to this function add_out_node(pid, new_out)
Link to this function child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function daemon_child_specs(config)

daemon_child_specs/1 needs to return a list of child specs. These child processes will be started under the DaemonNodeSupervisor.

Callback implementation for Exred.NodePrototype.daemon_child_specs/1.

Link to this function get_default_config()
Link to this function handle_msg(msg, state)

handle_msg/2 is called whenever the node receives a message from another node. It should return an {outgoing_msg, new_state} tuple.

Callback implementation for Exred.NodePrototype.handle_msg/2.

Link to this function set_out_nodes(pid, out_nodes)
Link to this function start_link(list)