Firmware API (Rust)
The firmware runs on a Raspberry Pi Pico 1 W (RP2040) in Rust + Embassy
(async, no_std). The full rustdoc reference is here:
➡️ Open the complete firmware API reference
Generated with cargo doc from firmware-rust-v2/, so it tracks the code.
Crate map
| Module | Purpose |
|---|---|
main | Init, 8 PWM channels, boot self-test, USB command loop |
config | Constants — motor count, PWM_TOP, power-guard caps, USB identity |
drivers::motors | Motors — drive the 8 motors by intensity (0..=255) |
proto | Binary protocol — FrameParser, Command, encode_event |
tasks::power_guard | Current cap (≤ 6 simultaneous motors at 60 % duty) |
tasks::motor_scheduler | MotorFrame composition |
Pin mapping
8 motors → 8 independent hardware PWM outputs. On the RP2040 an even GPIO is
channel A of slice gpio / 2, so the firmware uses GP0, GP2, GP4, GP6, GP8,
GP10, GP12, GP14 (channel A of slices 0–7), at ~20 kHz.
Pico W note: the on-board LED is wired to the CYW43 wireless chip, not a GPIO — a status LED needs an external GPIO.
See the serial protocol for the commands the firmware accepts.