CTL_STATUS_t ctl_i2c_read(CTL_I2C_BUS_t *self,
                          unsigned address,
                          void *rx,
                          size_t len);

ctl_i2c_read locks the I2C bus self using ctl_i2c_lock_bus and proceeds to read len bytes from the device with 8-bit slave address address and writes them to the object pointed to by rx which must be at least len bytes in size.

ctl_i2c_read waits unconditionally for the write and read to complete, unlocks the bus using ctl_i2c_unlock_bus, and returns a standard status code.

For exact I2C transaction details, see CTL_I2C_REQUEST_t.

Thread Safety

This function is thread-safe if a mutex is associated with the I2C bus self.

See Also