Struct i2c_linux_sys::i2c_msg [] [src]

#[repr(C)]
pub struct i2c_msg { pub addr: u16, pub flags: Flags, pub len: u16, pub buf: *mut u8, }

an I2C transaction segment beginning with START

An i2c_msg is the low level representation of one segment of an I2C transaction. It is visible to drivers in the i2c_transfer() procedure, to userspace from i2c-dev, and to I2C adapter drivers through the i2c_adapter.master_xfer() method.

Except when I2C "protocol mangling" is used, all I2C adapters implement the standard rules for I2C transactions. Each transaction begins with a START. That is followed by the slave address, and a bit encoding read versus write. Then follow all the data bytes, possibly including a byte with SMBus PEC. The transfer terminates with a NAK, or when all those bytes have been transferred and ACKed. If this is the last message in a group, it is followed by a STOP. Otherwise it is followed by the next i2c_msg transaction segment, beginning with a (repeated) START.

Alternatively, when the adapter supports I2C_FUNC_PROTOCOL_MANGLING then passing certain flags may have changed those standard protocol behaviors. Those flags are only for use with broken/nonconforming slaves, and with adapters which are known to support the specific mangling options they need (one or more of IGNORE_NACK, NO_RD_ACK, NOSTART, and REV_DIR_ADDR).

Fields

Slave address, either seven or ten bits.

When this is a ten bit address, I2C_M_TEN must be set in flags and the adapter must support I2C_FUNC_10BIT_ADDR.

I2C_M_RD is handled by all adapters.

No other flags may be provided unless the adapter exported the relevant I2C_FUNC_* flags through i2c_get_functionality().

Number of data bytes in buf being read from or written to the I2C slave address.

For read transactions where I2C_M_RECV_LEN is set, the caller guarantees that this buffer can hold up to 32 bytes in addition to the initial length byte sent by the slave (plus, if used, the SMBus PEC); and this value will be incremented by the number of block data bytes received.

The buffer into which data is read, or from which it's written.

Trait Implementations

impl Copy for i2c_msg
[src]

impl Clone for i2c_msg
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for i2c_msg
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl !Send for i2c_msg

impl !Sync for i2c_msg