Circuits.I2C.write_read
You're seeing just the function
write_read
, go back to Circuits.I2C module for more information.
Link to this function
write_read(i2c_bus, address, write_data, bytes_to_read, opts \\ [])
View SourceSpecs
write_read(bus(), address(), iodata(), pos_integer(), [opt()]) :: {:ok, binary()} | {:error, term()}
Write data
to an I2C device and then immediately issue a read.
This function is useful for devices that want you to write the "register"
location to them first and then issue a read to get its contents. Many
devices operate this way and this function will issue the commands
back-to-back on the I2C bus. Some I2C devices actually require that the read
immediately follows the write. If the target supports this, the I2C
transaction will be issued that way. On the Raspberry Pi, this can be enabled
globally with File.write!("/sys/module/i2c_bcm2708/parameters/combined", "1")
Options:
- :retries - number of retries before failing (defaults to no retries)