Circuits.I2C.Backend behaviour (circuits_i2c v2.1.0)
View SourceBackends provide the connection to the real or virtual I2C controller
Summary
Types
I2C transfer options
Callbacks
Return the I2C bus names on this system
Return information about this backend
Open an I2C bus
Types
@type transfer_options() :: keyword()
I2C transfer options
Support for options is backend-specific. Backends are encouraged to implement the following:
:retries
- the number of retries for this transaction
Callbacks
Return the I2C bus names on this system
See backend documentation for options.
@callback info() :: map()
Return information about this backend
@callback open(bus_name :: String.t(), options :: keyword()) :: {:ok, Circuits.I2C.Bus.t()} | {:error, term()}
Open an I2C bus
Bus names are typically of the form "i2c-n"
and available buses may be
found by calling bus_names/1
.
See Circuits.I2C.open_options/0
for guidance on options.