To make building easier just is used, see Justfile
.
To compile for Raspberry Pi, make sure to have the corresponding target and linker installed.
rustup target add aarch64-unknown-linux-gnu
# Or the equivalent for your package manager
yay -S aarch64-linux-gnu-gcc
- Change the method invocations in the
run
function insidedevice.rs
. - Change the used
wasm
file insidemain
.
This guest component is written in Rust and uses the received I²C connection to display hello world
to the HD44780 LCD screen.
This code is heavily influenced by the Rust crate hd44780-driver.
This guest component is also written in Rust and uses the connection to read the current temperature from a hts221.
The hts221 crate is used, to be precise a fork I made that adds embedded-hal
version 1 support, in tandem with wasi-embedded-hal.
To allow us to use the feature and thus use no std currently the nightly version of Rust is needed:
rustup install nightly
# The build commando is now slightly modified
cargo +nightly component build
See wasi-i2c for the source of the wit files.