1.8 KiB
1.8 KiB
cs-midi
A pico-sdk port of tttapa/Control-Surface (GPL-3.0).
cs-midi provides the full Control Surface MIDI element system — output elements, input elements, banks, selectors, MIDI routing, and the declarative Control_Surface singleton — for use with the Raspberry Pi Pico SDK.
Getting Started
#include "pico/stdlib.h"
#include <cs_midi.h>
using namespace cs;
BluetoothMIDI_Interface midi;
NoteButton button {5, {MIDI_Notes::C[4], Channel_1}};
int main() {
stdio_init_all();
Control_Surface.begin();
while (true) {
Control_Surface.loop();
sleep_ms(1);
}
}
Build
cs-midi is a static library meant to be included in a pico-sdk project:
add_subdirectory(lib/cs-midi)
target_link_libraries(your_target cs_midi)
CMake options (set before add_subdirectory()):
| Option | Default | Description |
|---|---|---|
CS_MIDI_BLE |
ON | BLE MIDI via BTstack |
CS_MIDI_USB |
OFF | USB MIDI via TinyUSB |
CS_MIDI_SERIAL |
OFF | Serial MIDI over UART |
CS_MIDI_APPLEMIDI |
OFF | AppleMIDI (RTP-MIDI over WiFi) |
USB MIDI requires tusb_config.h and usb_descriptors.c in your project — see templates/ for reference files.
To compile-verify all examples standalone:
cd lib/cs-midi && make tests
Differences from Control Surface
#include <cs_midi.h>replaces#include <Control_Surface.h>- Standard
main()replaces Arduinosetup()/loop() - All types live in the
cs::namespace - No
MCU::namespace yet — use raw CC numbers orMIDI_CC::constants
Credits
Original library: Control Surface by Pieter P (tttapa) (GPL-3.0). pico-sdk port: pszsh.