pub unsafe extern "C" fn i2c_transfer(
dev: *const device,
msgs: *mut i2c_msg,
num_msgs: u8,
addr: u16,
) -> i32Expand description
@brief Perform data transfer to another I2C device in controller mode.
This routine provides a generic interface to perform data transfer to another I2C device synchronously. Use i2c_read()/i2c_write() for simple read or write.
The array of message @a msgs must not be NULL. The number of message @a num_msgs may be zero,in which case no transfer occurs.
@note Not all scatter/gather transactions can be supported by all
drivers. As an example, a gather write (multiple consecutive
i2c_msg buffers all configured for I2C_MSG_WRITE) may be packed
into a single transaction by some drivers, but others may emit each
fragment as a distinct write transaction, which will not produce
the same behavior. See the documentation of struct i2c_msg for
limitations on support for multi-message bus transactions.
@note The last message in the scatter/gather transaction implies a STOP whether or not it is explicitly set. This ensures the bus is in a good state for the next transaction which may be from a different call context.
@param dev Pointer to the device structure for an I2C controller driver configured in controller mode. @param msgs Array of messages to transfer. @param num_msgs Number of messages to transfer. @param addr Address of the I2C target device.
@retval 0 If successful. @retval -EIO General input / output error.