A proposed WebAssembly System Interface API.
wasi-i2c is currently in Phase 2
- Friedrich Vandenberghe
- Merlijn Sebrechts
- Maximilian Seidler
WASI-I2C must have an implementation for at least the following platforms:
Platform | Architecture | Reference Hardware |
---|---|---|
Linux | ARM | Raspberry Pi 3 Model B |
RTOS (NuttX or Zephyr) | RISC-V | ESP32-C3 |
RTOS (Zephyr or FreeRTOS) | ARM32 | Nucleo F412ZG |
Furthermore, the interface should be designed in such a way to use as little memory as reasonably possible, to ensure enough RAM on these boards is still available for the applications.
The WASI-I2C proposal defines an API for the I2C protocol. The API of embedded_hal is closely followed.
Reference implementations can be found in i2c-wasm-components. Furthermore, there is also a wasi-embedded-hal crate that implements the embedded-hal
traits for the generated bindings.
The primary goal is to provide an interface that WASI programs can use to read and write data over an I2C connection.
Although I2C is in some aspects not that different from SPI, the purpose of this proposal is to solely focus on I2C.
The full API documentation can be found here.
[Walk through of how someone would use this API.]
[Provide example code snippets and diagrams explaining how the API would be used to solve the given problem]
[etc.]
Although embedded_hal
takes this approach, I would keep them separated for now. At least until each proposal is at least in Phase 2.
I2c resources will be constructed in many different ways on different devices, so worlds that include the i2c interface should also include a way to obtain i2c handles. Typically this will either be by having i2c handles passed into exported functions as parameters, or by having i2c handles returned from imported functions.
TODO before entering Phase 3.
Many thanks for valuable feedback and advice from:
- Merlijn Sebrechts
- Dan Gohman for the
hello-embedded
repository - Everyone else in SIG Embedded