You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support builds that completely exclude I2CDev support
This removes both the Elixir module and the NIF. There's no longer any
unintended NIF builds or loads or anything extra.
To enable this, either set the `:default_backend` application
environment key or force it by setting `:include_i2c_dev`. Most users
probably want:
```elixir
config :circuits_i2c, default_backend: MyI2CBackend
```
$(error Circuits.I2C Linux I2CDev backend is not supported on non-Linux platforms. Review circuits_i2c backend configuration or report an issue if improperly detected.)
so that it does not require board-dependent code. See the application
52
+
configuration for disabling all things Linux/Nerves specific.
52
53
53
54
## Getting started without hardware
54
55
55
56
If you don't have any real I2C devices, it's possible to work with simulated
56
57
devices. See the [CircuitsSim](https://github.com/elixir-circuits/circuits_sim)
57
58
project for details.
58
59
60
+
## Application config
61
+
62
+
`Circuits.I2C` supports the following application environment keys:
63
+
64
+
| Key | Description |
65
+
| --- | ----------- |
66
+
|`:include_i2c_dev`| Set to `true` or `false` to indicate whether or not to include the `Circuits.I2C.I2CDev` backend. |
67
+
|`:default_backend`| Default I2C backend to use when unspecified in API calls. The format is either a module name or a `{module_name, options}` tuple. |
68
+
69
+
`Circuits.I2C` uses a heuristic for the default values of both
70
+
`:include_i2c_dev`. For example, if the `:default_backend` is set to
71
+
`Circuits.I2C.I2CDev`, then `:include_i2c_dev` has to be `true`. If
72
+
`:default_backend` is set to something else, then `:include_i2c_dev` defaults to
73
+
`false`. If neither is set, then `Circuits.I2C.I2CDev` is built. On non-Linux
74
+
platforms, the `Circuits.I2C.I2CDev` NIF will be compiled in test mode which
75
+
minimal supports unit testing. Mocking is generally a better option for most
76
+
users, though.
77
+
59
78
## I2C background
60
79
61
80
An [Inter-Integrated Circuit](https://en.wikipedia.org/wiki/I%C2%B2C) (I2C) bus
0 commit comments