#wasm-component #embedded-hal #i2c #hal #delay #traits

no-std wasi-embedded-hal

Implementation of the embedded-hal traits for Wasm components

3 unstable releases

0.2.1 Jun 11, 2024
0.2.0 Mar 17, 2024
0.0.1 Mar 16, 2024

#1059 in WebAssembly

Download history 32/week @ 2024-07-28 9/week @ 2024-09-22 3/week @ 2024-09-29

267 downloads per month

Apache-2.0

11KB
178 lines

wasi-embedded-hal

Implementation of the embedded-hal traits for Webassembly components

Status

Currently only support for I2C and Delay is provided, but more is planned.

Note that only embedded-hal version 1.O is supported.

Usage

Simply use this crate and then add add_i2c_hal!(i2c) in your file. Where i2c is the module from bindings.rs generated by cargo-component.

Why the need for this crate

The generated bindings and the embedded-hal API differ slightly, e.g. &[...] vs. Vec<...>. This crate defines methods that follow the embedded-hal API, and that underneath call those from the generated bindings. Effectively allowing one to very easily use crates that adhere to embedded-hal inside Wasm.

Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.76.0 and up. It might compile with older versions but that may change in any new patch release.

Dependencies

~310KB