I2cServer (i2c_server v0.2.7) View Source
I2C Server wraps Circuits.I2C
reference
in a GenServer
, creating a separate process per
I2C bus.
Link to this section Summary
Functions
Run multiple operations in series blocking the process in favor of consistency.
Returns the module atom of currently-used bus registry.
Returns a specification to start this module under a supervisor.
Initiates a read transaction to the I2C device.
Replaces the currently-used bus registry with a different one.
Writes data to the I2C device.
Writes data to an I2C device and then immediately issue a read.
Link to this section Types
Specs
bus_address() :: 0..127
Specs
bus_name() :: binary()
Specs
bus_registry() :: I2cServer.Busbus_registry | :global | atom()
Specs
init_arg() :: [bus_name: bus_name(), bus_address: bus_address()]
Link to this section Functions
Specs
bulk(GenServer.server(), [ {:sleep, integer()} | {atom(), atom(), list()} | {:read, integer()} | {:write, integer(), iodata()} | {:write, integer(), integer(), binary() | integer()} | {:write_read, binary() | integer(), integer()} | function() ]) :: list()
Run multiple operations in series blocking the process in favor of consistency.
Specs
bus_registry() :: bus_registry()
Returns the module atom of currently-used bus registry.
Returns a specification to start this module under a supervisor.
See Supervisor
.
Specs
read(GenServer.server(), integer()) :: any()
Initiates a read transaction to the I2C device.
Specs
set_bus_registry(bus_registry()) :: :ok
Replaces the currently-used bus registry with a different one.
Specs
start_link(init_arg()) :: GenServer.on_start()
Specs
write(GenServer.server(), iodata()) :: any()
Writes data to the I2C device.
Specs
write(GenServer.server(), integer(), binary() | integer()) :: any()
Specs
write_read(GenServer.server(), iodata() | integer(), integer()) :: any()
Writes data to an I2C device and then immediately issue a read.