Synopsis
CTL_STATUS_t ctl_transport_read_registers_i2c(CTL_TRANSPORT_t *self,
                                              int reg,
                                              int n,
                                              void *data);
Description

ctl_transport_read_registers_i2c reads multiple registers from an I2C transport and is the default method installed into read_registers by ctl_transport_initialize_i2c.

The implementation of this depends upon ctl_i2c_write_read to issue a correct I2C bus transaction. A request to read n bytes from registers starting at reg on the I2C transport self is constructed, transacted over the bus, and the completion status returned.

The request to the I2C slave device is constructed which:

Return Value

ctl_transport_read_registers_i2c returns a standard status code.

Thread Safety

ctl_transport_read_registers_i2c is thread-safe if the transport self has a mutex associated with it. ctl_transport_read_registers_i2c ensures an atomic update of the register by locking the transport before writing the register and unlocking it after writing the register.