blob: 7a7e2ff449c52210a1d0b1a5499a0a11fcfd848b [file] [log] [blame] [view]
<link rel="stylesheet" href="../style.css" />
[TOC]
# fuchsia.hardware.i2c
<div class="fidl-version-div"><span class="fidl-attribute fidl-version">Added: 10</span></div>
## **PROTOCOLS**
## Device {#Device}
*Defined in [fuchsia.hardware.i2c/i2c.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.i2c/i2c.fidl;l=46)*
### GetName {#Device.GetName}
<p>Get the name of this I2C Device. Returns ZX_ERR_NOT_SUPPORTED if the
name is unspecified or the empty string.</p>
<div class="fidl-version-div"><span class="fidl-attribute fidl-version">Added: 11</span></div>
#### Request {#Device.GetName_Request}
&lt;EMPTY&gt;
#### Response {#Device.GetName_Response}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>result</code></td>
<td>
<code><a class='link' href='#Device_GetName_Result'>Device_GetName_Result</a></code>
</td>
</tr>
</table>
### Transfer {#Device.Transfer}
<p>Issue one or more transactions to a particular I2C device.</p>
<p>Each <code>Transaction</code> is performed in the order in which it appears in <code>transactions</code>. Data for
read transfers (if there are any) is returned through <code>read_data</code>, which has one entry for
each read transfer in <code>transactions</code>. Transaction processing continues until all transfers
have been completed, an error occurs, or the target issues a NACK in response to a write
transfer.</p>
<p>The possible error values are:
ZX_ERR_INVALID_ARGS: <code>transactions</code> has zero elements, <code>data_transfer</code> was not specified
for a <code>Transaction</code>, or there was a zero-length <code>DataTransfer</code>.
ZX_ERR_OUT_OF_RANGE: A <code>DataTransfer</code> 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.</p>
#### Request {#Device.Transfer_Request}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>transactions</code></td>
<td>
<code>vector&lt;<a class='link' href='#Transaction'>Transaction</a>&gt;[256]</code>
</td>
</tr>
</table>
#### Response {#Device.Transfer_Response}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>result</code></td>
<td>
<code><a class='link' href='#Device_Transfer_Result'>Device_Transfer_Result</a></code>
</td>
</tr>
</table>
## **STRUCTS**
### Device_GetName_Response {#Device_GetName_Response data-text="Device_GetName_Response"}
*Defined in [fuchsia.hardware.i2c/i2c.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.i2c/i2c.fidl;l=70)*
<table>
<tr><th>Field</th><th>Type</th><th>Description</th><th>Default</th></tr>
<tr id="Device_GetName_Response.name">
<td><code>name</code></td>
<td>
<code>string[64]</code>
</td>
<td></td>
<td>No default</td>
</tr>
</table>
### Device_Transfer_Response {#Device_Transfer_Response data-text="Device_Transfer_Response"}
*Defined in [fuchsia.hardware.i2c/i2c.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.i2c/i2c.fidl;l=63)*
<table>
<tr><th>Field</th><th>Type</th><th>Description</th><th>Default</th></tr>
<tr id="Device_Transfer_Response.read_data">
<td><code>read_data</code></td>
<td>
<code>vector&lt;vector&lt;uint8&gt;&gt;[256]</code>
</td>
<td></td>
<td>No default</td>
</tr>
</table>
## **TABLES**
### Transaction {#Transaction data-text="Transaction"}
*Defined in [fuchsia.hardware.i2c/i2c.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.i2c/i2c.fidl;l=37)*
<p><code>data_transfer</code> is mandatory, and specifies whether this transaction has a read or a write
transfer (see above).
<code>stop</code> 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 <code>stop</code>.</p>
<table>
<tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr>
<tr id="Transaction.data_transfer">
<td><h3 id="Transaction.data_transfer" class="add-link hide-from-toc">1</h3></td>
<td><code>data_transfer</code></td>
<td>
<code><a class='link' href='#DataTransfer'>DataTransfer</a></code>
</td>
<td></td>
</tr>
<tr id="Transaction.stop">
<td><h3 id="Transaction.stop" class="add-link hide-from-toc">2</h3></td>
<td><code>stop</code></td>
<td>
<code>bool</code>
</td>
<td></td>
</tr>
</table>
## **UNIONS**
### DataTransfer [flexible](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#DataTransfer data-text="DataTransfer"}
*Defined in [fuchsia.hardware.i2c/i2c.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.i2c/i2c.fidl;l=27)*
<p>If <code>read_size</code> is set: This is a read transfer, and <code>read_size</code> bytes will be read from the
target.
If <code>write_data</code> is set: This is a write transfer, and <code>write_data</code> will be written to the
target.</p>
<table>
<tr><th>Ordinal</th><th>Variant</th><th>Type</th><th>Description</th></tr>
<tr id="DataTransfer.read_size">
<td><h3 id="DataTransfer.read_size" class="add-link hide-from-toc">1</h3></td>
<td><code>read_size</code></td>
<td>
<code>uint32</code>
</td>
<td></td>
</tr>
<tr id="DataTransfer.write_data">
<td><h3 id="DataTransfer.write_data" class="add-link hide-from-toc">2</h3></td>
<td><code>write_data</code></td>
<td>
<code>vector&lt;uint8&gt;[32768]</code>
</td>
<td></td>
</tr>
</table>
### Device_GetName_Result [strict](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#Device_GetName_Result data-text="Device_GetName_Result"}
*Defined in [fuchsia.hardware.i2c/i2c.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.i2c/i2c.fidl;l=70)*
<table>
<tr><th>Ordinal</th><th>Variant</th><th>Type</th><th>Description</th></tr>
<tr id="Device_GetName_Result.response">
<td><h3 id="Device_GetName_Result.response" class="add-link hide-from-toc">1</h3></td>
<td><code>response</code></td>
<td>
<code><a class='link' href='#Device_GetName_Response'>Device_GetName_Response</a></code>
</td>
<td></td>
</tr>
<tr id="Device_GetName_Result.err">
<td><h3 id="Device_GetName_Result.err" class="add-link hide-from-toc">2</h3></td>
<td><code>err</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#status'>status</a></code>
</td>
<td></td>
</tr>
</table>
### Device_Transfer_Result [strict](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#Device_Transfer_Result data-text="Device_Transfer_Result"}
*Defined in [fuchsia.hardware.i2c/i2c.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.i2c/i2c.fidl;l=63)*
<table>
<tr><th>Ordinal</th><th>Variant</th><th>Type</th><th>Description</th></tr>
<tr id="Device_Transfer_Result.response">
<td><h3 id="Device_Transfer_Result.response" class="add-link hide-from-toc">1</h3></td>
<td><code>response</code></td>
<td>
<code><a class='link' href='#Device_Transfer_Response'>Device_Transfer_Response</a></code>
</td>
<td></td>
</tr>
<tr id="Device_Transfer_Result.err">
<td><h3 id="Device_Transfer_Result.err" class="add-link hide-from-toc">2</h3></td>
<td><code>err</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#status'>status</a></code>
</td>
<td></td>
</tr>
</table>
## **CONSTANTS**
<table>
<tr><th>Name</th><th>Value</th><th>Type</th><th>Description</th></tr>
<tr id="MAX_COUNT_TRANSACTIONS">
<td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.i2c/i2c.fidl;l=17">MAX_COUNT_TRANSACTIONS</a></td>
<td>
<code>256</code>
</td>
<td><code>uint32</code></td>
<td><p>The maximum number of transactions that can be specified in a call to <code>Transfer</code>.</p>
</td>
</tr>
<tr id="MAX_I2C_NAME_LEN">
<td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.i2c/i2c.fidl;l=21">MAX_I2C_NAME_LEN</a></td>
<td>
<code>64</code>
</td>
<td><code>uint32</code></td>
<td><p>Maximum length of the I2C Channel name.</p>
<div class="fidl-version-div"><span class="fidl-attribute fidl-version">Added: 11</span></div>
</td>
</tr>
<tr id="MAX_TRANSFER_SIZE">
<td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.i2c/i2c.fidl;l=14">MAX_TRANSFER_SIZE</a></td>
<td>
<code>32768</code>
</td>
<td><code>uint32</code></td>
<td><p>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.</p>
<p>The maximum number of bytes that can be read or written in a single <code>Transaction</code>.</p>
</td>
</tr>
</table>
## **ALIASES**
<table>
<tr><th>Name</th><th>Value</th><th>Description</th></tr>
<tr id="ReadData">
<td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.i2c/i2c.fidl;l=43">ReadData</a></td>
<td>
<code>vector</code>[<code><a class='link' href='#MAX_TRANSFER_SIZE'>MAX_TRANSFER_SIZE</a></code>]</td>
<td><p>Used to return data from read transfers.</p>
</td>
</tr>
</table>