I2cServer (i2c_server v0.2.0) View Source

I2C Server wraps Circuits.I2C reference in a GenServer, creating a separate process per I2C bus.

Link to this section Summary

Functions

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.

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

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.

Link to this function

read(server, read_count)

View Source

Specs

read(GenServer.server(), integer()) :: any()

Initiates a read transaction to the I2C device.

Specs

start_link(init_arg()) :: GenServer.on_start()
Link to this function

write(server, register_and_data)

View Source

Specs

write(GenServer.server(), iodata()) :: any()

Writes data to the I2C device.

Link to this function

write(server, register, data)

View Source

Specs

write(GenServer.server(), integer(), binary() | integer()) :: any()
Link to this function

write_read(server, write_data, read_count)

View Source

Specs

write_read(GenServer.server(), binary() | integer(), integer()) :: any()

Writes data to an I2C device and then immediately issue a read.