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

ctl_transport_write_registers_i2c writes multiple registers to an I2C transport and is the default method installed into write_registers by ctl_transport_initialize_i2c.

The implementation of this depends upon ctl_i2c_write to issue a correct I2C bus transaction. A request to write n bytes to 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:

Note

The implementation of ctl_transport_write_registers_i2c restricts the number of bytes written to 32.

Return Value

ctl_transport_write_registers_i2c returns a standard status code.

Thread Safety

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