Packages

OTP application for reading the BNO-055 absolute orientation sensor. Euler angles are read at 20hz and published to a configured local `gproc` property.

Current section

Files

Jump to
bno055 lib bno055.ex
Raw

lib/bno055.ex

defmodule BNO055 do
use Application
require Logger
def start(_type, _args) do
import Supervisor.Spec, warn: false
sensors = BNO055.Configuration.sensors
case BNO055.Configuration.validate_sensors(sensors) do
{:error, errs} ->
Logger.error("Errors found validating sensor(s) config: #{inspect sensors}")
Enum.map errs, fn err ->
Logger.error(err)
end
raise "Invalid sensor(s) configuration"
:ok -> :ok
end
children = [
supervisor(BNO055.Supervisor, [])
]
opts = [strategy: :one_for_one, name: __MODULE__]
case Mix.env do
:test -> Supervisor.start_link([], opts)
_ -> Supervisor.start_link(children, opts)
end
end
end