How 4dert/expression-pedal-to-midi-usb works
This Pico firmware converts an expression pedal’s analog position into USB MIDI control-change messages. The principal runtime loop services USB, pedal processing, button interactions, and LED behavior; button-driven calibration learns pedal range and electrical noise, then saves settings to flash for startup. The README also documents USB-host setup and a calibration workflow. The graph covers the sampled runtime and documented host interaction; USB descriptor and TinyUSB configuration files are shown as components, but their internal behavior was not excerpted.
Main entry points: main.c Runtime Orchestrator · exp_pedal.c Pedal ADC Processing · button.c Button Events · pwm_modulation.c Pedal LED Modulation
Components 14
Physical Inputs
- Pedal ADC Processing
src/exp_pedal.c - Range Calibration
src/exp_pedal.c - Noise Calibration
src/exp_pedal.c - Button Events
src/button.c
Device Firmware
- Runtime Orchestrator
src/main.c - Calibration Flash
src/flash.cpp
LED Feedback
- LED Driver
src/led.c - Pedal LED Modulation
src/pwm_modulation.c
USB MIDI
- MIDI Message Format
src/midi.h - USB Descriptors
src/usb_descriptors.c - TinyUSB Configuration
src/tusb_config.h
Other components
- Expression Pedal
- Device Operator
- MIDI Host
Connections 17
- Expression Pedal → Pedal ADC Processing: provides analog position
README.md - Device Operator → Button Events: presses
README.md - Runtime Orchestrator → Pedal ADC Processing: sets up and polls
src/main.c - Pedal ADC Processing → MIDI Message Format: emits control change
src/exp_pedal.c - Runtime Orchestrator → Button Events: initializes and polls
src/main.c - Button Events → Runtime Orchestrator: calls callback
src/button.c - Runtime Orchestrator → Range Calibration: selects calibration mode
src/main.c - Runtime Orchestrator → Noise Calibration: selects calibration mode
src/main.c - Pedal ADC Processing → Range Calibration: tracks range in mode
src/exp_pedal.c - Pedal ADC Processing → Noise Calibration: tracks noise in mode
src/exp_pedal.c - Runtime Orchestrator → Calibration Flash: loads and saves settings
src/main.c - Runtime Orchestrator → USB Descriptors: initializes USB device
src/main.c - USB Descriptors → TinyUSB Configuration
- MIDI Message Format → MIDI Host: transmits MIDI over USB
README.md - Runtime Orchestrator → LED Driver: controls status display
src/main.c - Runtime Orchestrator → Pedal LED Modulation: updates pedal indication
src/main.c - Pedal LED Modulation → LED Driver: sets PWM brightness
src/pwm_modulation.c