nils d2bebc9e7b Initial import: Rust BLE-MIDI keypad for Pico W
Port of the C/BTstack BLE-MIDI keypad firmware to Rust (embassy + cyw43 +
trouble). 16-pad RGB keypad (APA102 SPI + I2C button expander), BLE-MIDI 1.0
GATT server (full codec: sysex, running-status, real-time), octave display
on BOOTSEL, onboard LED heartbeat, USB serial logging.

- src/keypad.rs      Pimoroni RGB Keypad driver
- src/midi_keypad.rs pad->Note On/Off + LED response state machine
- src/codec.rs       BLE-MIDI 1.0 codec (port of rppicomidi, MIT)
- src/main.rs        cyw43 BT bring-up + trouble GATT + MIDI pump
- src/octave.rs      octave digit display on BOOTSEL

GPL-3.0-or-later; codec.rs retains its MIT (rppicomidi) attribution.
2026-08-21 08:44:19 +02:00

pico-pi-midi (Rust)

BLE-MIDI keypad firmware for the Raspberry Pi Pico W (RP2040 + CYW43439), written in Rust using embassy, the cyw43 driver (Bluetooth), and the TrouBLE BLE host.

This is the Rust port of the original C/BTstack firmware (now kept separately as pico-pi-midi-c). It talks BLE-MIDI 1.0 to iOS / macOS Core MIDI, turning the Pimoroni Pico RGB Keypad into a 16-pad wireless MIDI controller.

What it does

  • 16-pad keypad (Pimoroni RGB Keypad Base): reads buttons over I²C (GPIO expander @ 0x20) and drives APA102 RGB LEDs over SPI (CS=17, SCK=18, MOSI=19).
  • BLE-MIDI 1.0 GATT server (MIDI Service 03B80E5A-…), advertised so Core MIDI discovers it as a MIDI device. Pad presses → Note On/Off over Bluetooth; incoming Note On lights the pad.
  • Octave display: the BOOTSEL button cycles the keypad's note offset by +12 and flashes the active octave as a digit on the 4×4 grid for 500 ms.
  • Onboard LED heartbeat (driven via the CYW43 chip — the Pico W's LED is on the wireless chip, not an RP2040 pin).
  • USB serial logging via embassy-usb-logger — connect and read with screen /dev/cu.usbmodem* 115200 to see boot/advertising logs.

Roadmap

This is v1: a BLE-MIDI keypad. The goal is a flexible MIDI router — MIDI over USB, BLE, keypad, TRS, and 4 stereo CV outputs, with channels configurable at runtime via an LCD. See the architecture notes (kept in the session memory) for the plan.

Building

Requires Rust stable (≥1.93) and the thumbv6m-none-eabi target:

rustup target add thumbv6m-none-eabi
cargo build --release

The CYW43 firmware blobs (cyw43-firmware/*.bin) are committed here so no network access is needed at build time. They are redistributable under the permissive binary license in the upstream embassy cyw43-firmware directory.

Flashing

cargo build --release
elf2uf2-rs convert target/thumbv6m-none-eabi/release/rgb-keypad target/uf2/rgb-keypad.uf2
# hold BOOTSEL + plug in the Pico W, then:
picotool load target/uf2/rgb-keypad.uf2 -x

License

GPL-3.0-or-later (see LICENSE).

src/codec.rs is a Rust port of the BLE-MIDI 1.0 packet codec from rppicomidi/pico-w-ble-midi-lib, which is MIT-licensed; that attribution is retained in the file header. MIT is GPL-3.0-compatible, so the repository as a whole is GPL-3.0-or-later while that file preserves its MIT provenance.

S
Description
No description provided
Readme GPL-3.0
306 KiB
Languages
Rust 99.6%
RPC 0.4%