Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

ModulePurpose
mainInit, 8 PWM channels, boot self-test, USB command loop
configConstants — motor count, PWM_TOP, power-guard caps, USB identity
drivers::motorsMotors — drive the 8 motors by intensity (0..=255)
protoBinary protocol — FrameParser, Command, encode_event
tasks::power_guardCurrent cap (≤ 6 simultaneous motors at 60 % duty)
tasks::motor_schedulerMotorFrame 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.