nerves_pack v0.2.0 NervesPack.WiFiWizardButton View Source

Starts the wizard if a button is depressed for long enough.

Note: Using this requires Circuits.GPIO be included as a dependency in your project:

def deps() do
  {:circuits_gpio, "~> 0.4"}
end

It is recommended that you start this in your own supverision separate from NervesPack. This module mainly serves as a convenience and example for simple management of VintageNetWizard:

def start(_type, _args) do
  children = [
    NervesPack.WiFiWizardButton
    ...
  ]

  opts = [strategy: :one_for_one, name: MyApp.Supervisor]
  Supervisor.start_link(children, opts)
end

Though you can also enable this in the config as well which will start it within NervesPack.Supervisor instead:

config :nerves_pack, wifi_wizard_button: true

GPIO 26 is used for the button and the hold time is 5 seconds. These defaults can be configured when adding as a supervised child or in the config if desired:

# Supervised child
children = [
  {NervesPack.WiFiWizardButton, [pin: 12, hold: 4_000]},
  ...
]

# config.exs
config :nerves_pack,
  wifi_wizard_button_pin: 17,
  wifi_wizard_button_hold: 3_000

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Start the button monitor

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

start_link(opts \\ [])

View Source
start_link(list()) :: GenServer.on_start()

Start the button monitor