cs-midi-docs/docs/manual/01-getting-started/01-installation.md

1.8 KiB

Installation

Original: Installation

cs-midi is a CMake static library included as a subdirectory of your pico-sdk project.

Prerequisites

  • pico-sdk (1.5.1+)
  • CMake 3.13+
  • ARM GCC toolchain (arm-none-eabi-gcc)

Adding cs-midi to your project

Place cs-midi under lib/ (or any subdirectory) and add it from your project's CMakeLists.txt:

cmake_minimum_required(VERSION 3.13)

include(pico_sdk_import.cmake)

project(my_controller C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

pico_sdk_init()

# Enable desired transports before add_subdirectory
set(CS_MIDI_BLE ON)
set(CS_MIDI_USB OFF)
set(CS_MIDI_SERIAL OFF)
set(CS_MIDI_APPLEMIDI OFF)

add_subdirectory(lib/cs-midi)

add_executable(my_controller main.cpp)
target_link_libraries(my_controller cs_midi)

pico_add_extra_outputs(my_controller)

Board configuration

For RP2350 boards with the RM2 radio module, cs-midi provides a board header:

set(PICO_BOARD waveshare_rp2350b_plus_w)
set(PICO_BOARD_HEADER_DIRS ${CMAKE_SOURCE_DIR}/lib/cs-midi/boards)

For Pico W (RP2040), use the built-in pico_w board:

set(PICO_BOARD pico_w)

CMake options

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)
CS_MIDI_HID_KEYBOARD OFF HID keyboard + Battery Service for BLE auto-reconnect

USB MIDI requires tusb_config.h and usb_descriptors.c in your project — see templates/ for reference files.