Synopsis
void ctl_transport_initialize_i2c(CTL_TRANSPORT_t *self,
                                  CTL_I2C_BUS_t *bus,
                                  int addr,
                                  int big_endian);
Description

ctl_transport_initialize_i2c initializes the transport self to use standard sub-addressed read and writes requests to device registers. The device addressed is on I2C bus bus at 8-bit I2C address addr.

big_endian specifies the byte order of multi-byte registers; if big_endian is non-zero, consecutive byte registers comprising a multi-byte register are in big-endian (network) byte order, otherwise they are in little-endian (PC) byte order.

The methods read_registers and write_registers of the transport are initialized to ctl_transport_read_registers_i2c and ctl_transport_write_registers_i2c. For most devices, these functions are sufficient to read and write device registers, but some devices may require special handling, such as setting a bit in the register sub-address to indicate incrementing addresses. If this is the case, the client can simply substitute its replacement register access methods after the transport is initialized.

See Also

ctl_transport_read_registers_i2c, ctl_transport_write_registers_i2c