generated from WebAssembly/wasi-proposal-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Zelzahn/main
Suggested changes
- Loading branch information
Showing
10 changed files
with
276 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Copyright © 2019-2023 the Contributors to the WASI Specification, published | ||
by the [WebAssembly Community Group][cg] under the | ||
[W3C Community Contributor License Agreement (CLA)][cla]. A human-readable | ||
[summary][summary] is available. | ||
|
||
[cg]: https://www.w3.org/community/webassembly/ | ||
[cla]: https://www.w3.org/community/about/agreements/cla/ | ||
[summary]: https://www.w3.org/community/about/agreements/cla-deed/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
<h1><a name="imports">World imports</a></h1> | ||
<ul> | ||
<li>Imports: | ||
<ul> | ||
<li>interface <a href="#wasi:i2c_i2c_0.2.0_draft"><code>wasi:i2c/[email protected]</code></a></li> | ||
<li>interface <a href="#wasi:i2c_delay_0.2.0_draft"><code>wasi:i2c/[email protected]</code></a></li> | ||
</ul> | ||
</li> | ||
</ul> | ||
<h2><a name="wasi:i2c_i2c_0.2.0_draft"></a>Import interface wasi:i2c/[email protected]</h2> | ||
<p>Inter-Integrated Circuit (I²C) API that is based upon <a href="https://github.com/sunfishcode/hello-embedded/tree/main">hello-embedded</a> and <a href="https://github.com/rust-embedded/embedded-hal">embedded-hal</a>.</p> | ||
<hr /> | ||
<h3>Types</h3> | ||
<h4><a name="address"></a><code>type address</code></h4> | ||
<p><code>u16</code></p> | ||
<p>An address value, in either 7-bit or 10-bit form, depending on the device. | ||
<h4><a name="no_acknowledge_source"></a><code>enum no-acknowledge-source</code></h4> | ||
<p>No-acknowledge error source.</p> | ||
<p>In cases where it is possible, a device should indicate if a no | ||
acknowledge response was received to an address versus a no acknowledge | ||
to a data byte. Where it is not possible to differentiate, Unknown | ||
should be indicated.</p> | ||
<h5>Enum Cases</h5> | ||
<ul> | ||
<li> | ||
<p><a name="no_acknowledge_source.address"></a><a href="#address"><code>address</code></a></p> | ||
<p>The device did not acknowledge its address. The device may be | ||
missing. | ||
</li> | ||
<li> | ||
<p><a name="no_acknowledge_source.data"></a><code>data</code></p> | ||
<p>The device did not acknowledge the data. It may not be ready to | ||
process requests at the moment. | ||
</li> | ||
<li> | ||
<p><a name="no_acknowledge_source.unknown"></a><code>unknown</code></p> | ||
<p>Either the device did not acknowledge its address or the data, but | ||
it is unknown which. | ||
</li> | ||
</ul> | ||
<h4><a name="error_code"></a><code>variant error-code</code></h4> | ||
<p>Operation errors.</p> | ||
<h5>Variant Cases</h5> | ||
<ul> | ||
<li> | ||
<p><a name="error_code.bus"></a><code>bus</code></p> | ||
<p>Bus error occurred. e.g. A START or a STOP condition is detected and | ||
is not located after a multiple of 9 SCL clock pulses. | ||
</li> | ||
<li> | ||
<p><a name="error_code.arbitration_loss"></a><code>arbitration-loss</code></p> | ||
<p>The arbitration was lost, e.g. electrical problems with the clock signal. | ||
</li> | ||
<li> | ||
<p><a name="error_code.no_acknowledge"></a><code>no-acknowledge</code>: <a href="#no_acknowledge_source"><a href="#no_acknowledge_source"><code>no-acknowledge-source</code></a></a></p> | ||
<p>A bus operation was not acknowledged, e.g. due to the addressed | ||
device not being available on the bus or the device not being ready | ||
to process requests at the moment. | ||
</li> | ||
<li> | ||
<p><a name="error_code.overrun"></a><code>overrun</code></p> | ||
<p>The peripheral receive buffer was overrun. | ||
</li> | ||
<li> | ||
<p><a name="error_code.other"></a><code>other</code></p> | ||
<p>A different error occurred. | ||
</li> | ||
</ul> | ||
<h4><a name="operation"></a><code>variant operation</code></h4> | ||
<p>An operation used by the <code>transaction</code> method.</p> | ||
<h5>Variant Cases</h5> | ||
<ul> | ||
<li> | ||
<p><a name="operation.read"></a><code>read</code>: <code>u64</code></p> | ||
<p>Read the give number of bytes. | ||
</li> | ||
<li> | ||
<p><a name="operation.write"></a><code>write</code>: list<<code>u8</code>></p> | ||
<p>Write the given bytes. | ||
</li> | ||
</ul> | ||
<h4><a name="i2c"></a><code>resource i2c</code></h4> | ||
<hr /> | ||
<h3>Functions</h3> | ||
<h4><a name="method_i2c.transaction"></a><code>[method]i2c.transaction: func</code></h4> | ||
<p>Execute the provided <a href="#operation"><code>operation</code></a>s on the I²C bus.</p> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a name="method_i2c.transaction.self"></a><code>self</code>: borrow<<a href="#i2c"><a href="#i2c"><code>i2c</code></a></a>></li> | ||
<li><a name="method_i2c.transaction.address"></a><a href="#address"><code>address</code></a>: <a href="#address"><a href="#address"><code>address</code></a></a></li> | ||
<li><a name="method_i2c.transaction.operations"></a><code>operations</code>: list<<a href="#operation"><a href="#operation"><code>operation</code></a></a>></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
<li><a name="method_i2c.transaction.0"></a> result<list<list<<code>u8</code>>>, <a href="#error_code"><a href="#error_code"><code>error-code</code></a></a>></li> | ||
</ul> | ||
<h4><a name="method_i2c.read"></a><code>[method]i2c.read: func</code></h4> | ||
<p>Reads <code>len</code> bytes from address <a href="#address"><code>address</code></a>.</p> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a name="method_i2c.read.self"></a><code>self</code>: borrow<<a href="#i2c"><a href="#i2c"><code>i2c</code></a></a>></li> | ||
<li><a name="method_i2c.read.address"></a><a href="#address"><code>address</code></a>: <a href="#address"><a href="#address"><code>address</code></a></a></li> | ||
<li><a name="method_i2c.read.len"></a><code>len</code>: <code>u64</code></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
<li><a name="method_i2c.read.0"></a> result<list<<code>u8</code>>, <a href="#error_code"><a href="#error_code"><code>error-code</code></a></a>></li> | ||
</ul> | ||
<h4><a name="method_i2c.write"></a><code>[method]i2c.write: func</code></h4> | ||
<p>Writes bytes to target with address <a href="#address"><code>address</code></a>.</p> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a name="method_i2c.write.self"></a><code>self</code>: borrow<<a href="#i2c"><a href="#i2c"><code>i2c</code></a></a>></li> | ||
<li><a name="method_i2c.write.address"></a><a href="#address"><code>address</code></a>: <a href="#address"><a href="#address"><code>address</code></a></a></li> | ||
<li><a name="method_i2c.write.data"></a><code>data</code>: list<<code>u8</code>></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
<li><a name="method_i2c.write.0"></a> result<_, <a href="#error_code"><a href="#error_code"><code>error-code</code></a></a>></li> | ||
</ul> | ||
<h4><a name="method_i2c.write_read"></a><code>[method]i2c.write-read: func</code></h4> | ||
<p>Writes bytes to address <a href="#address"><code>address</code></a> and then reads <code>read-len</code> bytes | ||
in a single transaction.</p> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a name="method_i2c.write_read.self"></a><code>self</code>: borrow<<a href="#i2c"><a href="#i2c"><code>i2c</code></a></a>></li> | ||
<li><a name="method_i2c.write_read.address"></a><a href="#address"><code>address</code></a>: <a href="#address"><a href="#address"><code>address</code></a></a></li> | ||
<li><a name="method_i2c.write_read.write"></a><code>write</code>: list<<code>u8</code>></li> | ||
<li><a name="method_i2c.write_read.read_len"></a><code>read-len</code>: <code>u64</code></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
<li><a name="method_i2c.write_read.0"></a> result<list<<code>u8</code>>, <a href="#error_code"><a href="#error_code"><code>error-code</code></a></a>></li> | ||
</ul> | ||
<h2><a name="wasi:i2c_delay_0.2.0_draft"></a>Import interface wasi:i2c/[email protected]</h2> | ||
<p>Delays.</p> | ||
<hr /> | ||
<h3>Types</h3> | ||
<h4><a name="delay"></a><code>resource delay</code></h4> | ||
<h2>Delay with up to nanosecond precision.</h2> | ||
<h3>Functions</h3> | ||
<h4><a name="method_delay.delay_ns"></a><code>[method]delay.delay-ns: func</code></h4> | ||
<p>Pauses execution for at minimum <code>ns</code> nanoseconds. Pause can be | ||
longer if the implementation requires it due to precision/timing | ||
issues.</p> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a name="method_delay.delay_ns.self"></a><code>self</code>: borrow<<a href="#delay"><a href="#delay"><code>delay</code></a></a>></li> | ||
<li><a name="method_delay.delay_ns.ns"></a><code>ns</code>: <code>u32</code></li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package wasi:i2c@0.2.0-draft; | ||
|
||
/// Delays. | ||
interface delay { | ||
/// Delay with up to nanosecond precision. | ||
resource delay { | ||
/// Pauses execution for at minimum `ns` nanoseconds. Pause can be | ||
/// longer if the implementation requires it due to precision/timing | ||
/// issues. | ||
delay-ns: func(ns: u32); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.