How maujabur/midi-usb-esp32s3 works
This ESP32-S3 firmware provides three distinct profiles: the primary USB-host MIDI controller, a USB-MIDI device, and a USB-to-UART serial bridge. In the primary workflow, the BOOT button is debounced, press/release events advance a note sequence, and MIDI output is queued and sent to an enumerated MIDI device such as the FM1. The device profile exposes MIDI to a USB host; the bridge relays serial data for log monitoring. The host source excerpt is partial, so its internal task and transfer details are represented only where shown.
Main entry points: device/main.cpp Device application · host/main.cpp Host application · button_fsm.h Button debounce · note_sequence.h Note sequencer
Components 12
Shared MIDI logic
- Button debounce
lib/core/button_fsm.h - Note sequencer
lib/core/note_sequence.h - MIDI output interface
lib/core/midi_out.h
USB host controller
- Host application
src/host/main.cpp - USB host MIDI
src/host/usb_host_midi.cpp
USB MIDI device
- Device application
src/device/main.cpp
Serial bridge
- Serial bridge
src/bridge/main.cpp
Other components
- BOOT button
- FM1 MIDI device
- USB MIDI host
- Host UART log
- USB serial monitor
Connections 17
- BOOT button → Host application: pressed at
src/host/main.cpp - Host application → Button debounce: updates
src/host/main.cpp - Button debounce → Host application: returns events
src/host/main.cpp - Host application → Note sequencer: dispatches events
src/host/main.cpp - Note sequencer → MIDI output interface: sends notes
lib/core/note_sequence.h - Host application → USB host MIDI: starts host
src/host/main.cpp - USB host MIDI → FM1 MIDI device: sends USB-MIDI
- BOOT button → Device application: pressed at
src/device/main.cpp - Device application → Button debounce: updates
src/device/main.cpp - Button debounce → Device application: returns events
src/device/main.cpp - Device application → Note sequencer: dispatches events
src/device/main.cpp - Device application → MIDI output interface: implements output
src/device/main.cpp - Note sequencer → Device application: sends notes
lib/core/note_sequence.h - Device application → USB MIDI host: exposes USB MIDI
README.md - Host application → Host UART log: writes logs
src/host/main.cpp - Host UART log → Serial bridge: relays UART
README.md - Serial bridge → USB serial monitor: forwards serial
src/bridge/main.cpp