fuchsia.hardware.i2c

Added: 10

PROTOCOLS

Device

Defined in fuchsia.hardware.i2c/i2c.fidl

GetName

Get the name of this I2C Device. Returns ZX_ERR_NOT_SUPPORTED if the name is unspecified or the empty string.

Added: 11

Request

<EMPTY>

Response

NameType
payload Device_GetName_Result

Transfer

Issue one or more transactions to a particular I2C device.

Each Transaction is performed in the order in which it appears in transactions. Data for read transfers (if there are any) is returned through read_data, which has one entry for each read transfer in transactions. Transaction processing continues until all transfers have been completed, an error occurs, or the target issues a NACK in response to a write transfer.

The possible error values are: ZX_ERR_INVALID_ARGS: transactions has zero elements, data_transfer was not specified for a Transaction, or there was a zero-length DataTransfer. ZX_ERR_OUT_OF_RANGE: A DataTransfer was too large to be handled by this I2C controller. ZX_ERR_IO_NOT_PRESENT: The device did not respond to its I2C address. ZX_ERR_IO_REFUSED: The device issued a NACK before the end of a write transfer.

Request

NameType
transactions vector<Transaction>[256]

Response

NameType
payload Device_Transfer_Result

STRUCTS

Device_GetName_Response

Defined in fuchsia.hardware.i2c/i2c.fidl

FieldTypeDescriptionDefault
name string[64] No default

Device_Transfer_Response

Defined in fuchsia.hardware.i2c/i2c.fidl

FieldTypeDescriptionDefault
read_data vector<vector<uint8>>[256] No default

TABLES

Transaction

Defined in fuchsia.hardware.i2c/i2c.fidl

data_transfer is mandatory, and specifies whether this transaction has a read or a write transfer (see above). stop is optional, and specifies whether this transaction is terminated by a stop condition (if true) or by a repeated-start (if false or unspecified). If this transaction is the last in the list then a stop condition is generated regardless of the value of stop.

OrdinalFieldTypeDescription
data_transfer DataTransfer
stop bool

UNIONS

DataTransfer flexible

Defined in fuchsia.hardware.i2c/i2c.fidl

If read_size is set: This is a read transfer, and read_size bytes will be read from the target. If write_data is set: This is a write transfer, and write_data will be written to the target.

OrdinalVariantTypeDescription
read_size uint32
write_data vector<uint8>[32768]

Device_GetName_Result strict

Defined in fuchsia.hardware.i2c/i2c.fidl

OrdinalVariantTypeDescription
response Device_GetName_Response
err zx/Status

Device_Transfer_Result strict

Defined in fuchsia.hardware.i2c/i2c.fidl

OrdinalVariantTypeDescription
response Device_Transfer_Response
err zx/Status

CONSTANTS

NameValueTypeDescription
MAX_COUNT_TRANSACTIONS 256 uint32

The maximum number of transactions that can be specified in a call to Transfer.

MAX_I2C_NAME_LEN 64 uint32

Maximum length of the I2C Channel name.

Added: 11
MAX_TRANSFER_SIZE 32768 uint32

Clients should be aware of the max channel message size when using large transfers or many transactions. It is possible to generate a message that uses values less than the limits below but is still too big for the channel.

The maximum number of bytes that can be read or written in a single Transaction.

ALIASES

NameValueDescription
ReadData vector[MAX_TRANSFER_SIZE]

Used to return data from read transfers.

SERVICES

Service

Defined in fuchsia.hardware.i2c/i2c.fidl

NameTypeTransport
device fuchsia.hardware.i2c/Device Channel