WireWeaver is an API code generator for microcontrollers, supporting user-defined types, methods, properties, streams, and traits. It handles unsized types like Vec and String even in no_std environments without an allocator, and ensures full backward and forward compatibility between devices across format versions.
Currently only Rust language is supported, with the idea to handle device communications in Rust and provide higher level bindings for Python, C++ and other languages. C support is tentatively planned to be implemented directly, to run e.g., on TMS320 DSPs.
Current state is - approaching alpha release.
Documentation with a step-by-step guide is available here.
Supported:
- RPC - functions with any number of arguments of any type, returning any type
- Streams of bytes or objects
- Properties of any type
- Traits
- Blocking and async mode
- USB without drivers on Windows, Linux and macOS
- soon: WebSocket and UDP support
- soon: CAN bus support
Traits can be made "global" by publishing them on crates.io. Useful for things like logging, GPIO control or firmware update, allowing code reuse across projects.
Wire format used (called shrink_wrap) is binary and designed to use bits and nibbles to make it compact without compression. See comparison to other formats in examples/compare_wire_formats.
Easiest way to start using WireWeaver is through one of the templates below, which contain firmware for several development boards, API, client and Python bindings crates.
If you do not have physical hardware at hand, there is virtual device support.
This is a minimal example showing an MCU firmware with USB, common no_std API crate, server on the MCU and client in Rust and Python.
TODO
See Project setup page in the docs, which explains how setup projects in more detail for both std and no_std use.
TODO
wire_weaver_ prefix is used on core crates that implement all the functionality.
ww_ prefix is used on crates using WireWeaver to provide standard library types and traits. Use it as well if you
think that your crate is useful across multiple projects.
