nerves_pack v0.2.2 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 supervision 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
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Start the button monitor