WASM
A WASM guest is a sandboxed module that runs on-device; it compiles the same generated onewili.h header (C) or onewili crate (Rust) as the host libraries above, so the device API surface - types, functions, signatures - is identical. Only the transport differs: instead of opening a serial port, the guest opens the host device that already loaded it.
Build the guest with the bundled wiliclang for the wasm32 target:
wiliclang --target=wasm32 -o guest.wasm guest.c
The guest calls themselves are thin - argument packing only: the firmware assembles the wire command, runs it, and decodes the response natively in flash via the single ow_call import, so there is no per-command interpreter overhead.
Open the device and send a first command, in C:
ow_device dev;
ow_open_wasm(&dev);
/* ow_status ow_gui_set_led_color(ow_device* dev, int32_t ledindex, int32_t red, int32_t green, int32_t blue, int32_t duration, ow_ow_led_manager_led_mode mode); */
ow_status r = ow_gui_set_led_color(&dev, /* args */);
or in Rust:
let mut dev = onewili::OneWili::open()?;
// dev.gui().set_led_color(ledindex: i32, red: i32, green: i32, blue: i32, duration: i32, mode: owLEDManagerLEDMode) -> Result<(), OwError>
dev.gui().set_led_color(/* args */)?;
Full command list: GUI Functions - or start at the API index.