fuchsia.hardware.i2c

PROTOCOLS

Device

Defined in fuchsia.hardware.i2c/i2c.fidl

SubordinateTransfer

Send and receive data on the I2C device.

Request

NameType
in vector<uint8>[8196]

Response

NameType
s zx/status
out vector<uint8>[8196]

Device2

Defined in fuchsia.hardware.i2c/i2c.fidl

Transfer

Write and read segments of data for a particular I2C device.

The segments_is_write vector specifies the type (write or read) of each segment. The write_segments_data vector of segments specifies the data to write for each write segment. Each segment itself is a vector of uint8s, so write_segments_data is a vector of vectors of uint8s. The read_segments_length vector specifies the length of the read segments. If there is no error, read_segments_data returns a vector of segments, with each segment data itself returned in vectors.

For a simple I2C read, for instance 2 bytes write followed by one byte read, segments_is_write would be a vector with 2 elements: true, false and write_segments_data would be a vector with 1 element including the 2 bytes address of the read. Upon success read_segments_data would return a vector with one element, the byte read.

Request

NameType
segments_is_write vector<bool>[8]
write_segments_data vector<vector>[8]
read_segments_length vector<uint8>[8]

Response

NameType
result Device2_Transfer_Result

STRUCTS

Device2_Transfer_Response

Defined in fuchsia.hardware.i2c/i2c.fidl

NameTypeDescriptionDefault
read_segments_data vector<vector>[8] No default

Segment

Defined in fuchsia.hardware.i2c/i2c.fidl

Segment header for a serialized SubordinateTransfer. TODO(ZX-3029): Avoid requiring serialization and have SubordinateTransfer take an argument of vector<Segment>:MAX_SEGMENTS instead once we have better support in the C bindings or for C++.

NameTypeDescriptionDefault
type uint32 No default
len uint32 No default

ENUMS

SegmentType

Type: uint32

Defined in fuchsia.hardware.i2c/i2c.fidl

NameValueDescription
END 1

Flags the end of a serialized list of segments.

READ 2

Segment to be read from the I2C device.

WRITE 3

Segment to be written to the I2C device.

UNIONS

Device2_Transfer_Result

Defined in fuchsia.hardware.i2c/i2c.fidl

NameTypeDescription
response Device2_Transfer_Response
err zx/status

CONSTANTS

NameValueTypeDescription
MAX_TRANSFER_SIZE 8196 uint32
MAX_COUNT_SEGMENTS 8 uint32