-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paththe_eye.ex
More file actions
32 lines (26 loc) · 1003 Bytes
/
Copy paththe_eye.ex
File metadata and controls
32 lines (26 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
defmodule TheEye do
use Application
@kernel_module "brcmfmac"
@interface :wlan0
@wifi_cfg Application.get_env(:the_eye, @interface)
def start(_type, _args) do
import Supervisor.Spec, warn: false
neopixel_cfg = Application.get_env(:lightning, :channel0)
# Define workers and child supervisors to be supervised
children = [
worker(Task, [fn -> init_kernel_modules() end], restart: :transient, id: Nerves.Init.KernelModules),
worker(Task, [fn -> init_network() end], restart: :transient, id: Nerves.Init.Network),
worker(Nerves.Neopixel, [neopixel_cfg, nil]),
]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: TheEye.Supervisor]
Supervisor.start_link(children, opts)
end
def init_kernel_modules() do
System.cmd("modprobe", [@kernel_module])
end
def init_network() do
Nerves.Network.setup(@interface, @wifi_cfg)
end
end