YOSHIMITSU · API Reference
The Hermetic Shinobi as a library: one relaxed sketch, two targets, six stances, and the 極光-gated console that administers the throne.
Architecture
YOSHIMITSU is a library with a thin sketch on top. The whole core lives in src/Yoshimitsu.h; every default lives in src/Yoshimitsu_Loadout.h as _DEFAULT values (pins, timings, gate levels). The sketch — yoshimitsu.ino or the examples/Yoshimitsu_Default/ copy — only holds your* configuration and any overrides you define before the include. Update the library without re-touching your sketch.
Target detection is automatic: ARDUINO_ARCH_RP2040 selects the RP2040-Tiny path (Servo.h, RESET-tap stance switching), ARDUINO_ARCH_ESP32/ARDUINO_ARCH_ESP32S3 selects the ESP32-S3 path (ESP32Servo.h, native USB). Anything else fails at compile time with a clear #error.
graph TB SKETCH["yoshimitsu.ino
the relaxed sketch — config only"] LOADOUT["Yoshimitsu_Loadout.h
the starting loadout · *_DEFAULT"] CORE["src/Yoshimitsu.h
the whole core"] STANCES["six stances
KINCHO · MANJI · FLEA
MEDITATION · NSS · BACK"] CONSOLE["USB-serial console
極光-gated admin"] CRSF["CRSF RX"] BRIDGE["MUSHIN bridge
無心 no-mind protocol"] PWM["servo PWM
wing L/R · crest"] SKETCH --> CORE LOADOUT --> CORE CRSF --> CORE BRIDGE --> CORE CONSOLE --> CORE CORE --> STANCES STANCES --> PWM
The Six Stances
Every stance is a Stance enum value (0–5) chosen at runtime — by USB command, a GPIO0 button (ESP32-S3) or RESET-taps (RP2040-Tiny).
| Stance | Duty |
|---|---|
KINCHO
|
The parry — CRSF→PWM converter; radio channels become servo microseconds. |
MANJI_DRAGONFLY
|
The levitation — converter plus the local Zephyrus gyro PID on the crest. |
FLEA
|
The lift — power-cycle jig that drops the receiver into bootloader, then MEDITATION. |
MEDITATION
|
The sponge-head — pocket flasher; USB↔UART is a pure transparent bridge for esptool. |
NSS
|
The no-sword bench — direct servo drive ( |
BACK_TURNED
|
The mirror — deceptive idle; the UART echo never looks back. |
Compile-Time Gates
Everything optional compiles out cleanly when disabled — no dead bytes, no dangling references. Override any of these in your sketch before the include.
JIGUANG— the storyteller / administrator (1= omnipresent,0= zero 極光 bytes compiled in).YOSHI_GYRO— the Zephyrus MPU6050 gyro path.YOSHI_RGB— the onboard WS2812B aurora (the always-on stance colour).JIGUANG_PROMPT— the admin console prompt string (default"極光"); rename it in the sketch.BOARD_CUSTOM— supply your ownCUSTOM_RP2040_*_DEFAULT/CUSTOM_S3_*_DEFAULTpins.
Console API
Stance commands stay open: KINCHO, MANJI, FLEA, MEDITATION, NSS, BACK, POSE n, plus STATUS, SERVO i us and HELP. Administrator commands are gated behind the prompt: type 極光 first, then DOC, SETUP, JIGUANG, MUTE, CRSF, SCORE, ELRS, LEGEND, BRIDGE, ADMIN or MUSHIN.
極光 DOC prints the cheatcode catalog; 極光 SETUP prints the meditation wizard (stance, voice level, MUSHIN state, receiver power). A non-prompt line hitting a gated command answers "the throne is guarded" and returns.
MUSHIN 無心 — the no-mind protocol
The muscle-memory bridge (spirit→muscle) speaks a 4-field frame over the same two wires as the flasher. Boots armed, persisted in flash.
[0x9B][len][type][payload][xor]
0x01 INTENT n × uint16 µs per servo
0x02 ANNOUNCE 1 Hz keepalive
0x03 TELEMETRY gyro rate + correction
Deployment
Install the sketches/yoshimitsu folder as an Arduino library, then open File → Examples → Yoshimitsu → Yoshimitsu_Default. Flash once; after that, updates are git pull or a new release — the sketch stays untouched.
Troubleshooting
YOSHIMITSU targets ESP32-S3 or RP2040 only— your board is neither; check Tools → Board or defineBOARD_CUSTOM.A command answers "the throne is guarded" — it is an administrator command; type
極光first.esptool times out in MEDITATION — confirm the bridge UART pins (
BRIDGE_RX_PIN/BRIDGE_TX_PIN) match your wiring.