AwesomeStudioPedal
A programmable, multi-profile foot controller for DAWs, score readers, and studio automation
Loading...
Searching...
No Matches
Architecture

High-level component diagram

graph TD
main["main.cpp"]
ED["EventDispatcher"]
PM["ProfileManager"]
AH["Action hierarchy"]
LED["LEDController (ILEDController)"]
BTN["ButtonController (IButtonController)"]
BLE["BleKeyboardAdapter (IBleKeyboard)"]
main --> ED
main --> PM
main --> LED
main --> BTN
main --> BLE
ED --> PM
PM --> AH
AH --> BLE
AH --> LED

Action class hierarchy

classDiagram
Action <|-- SendAction
Action <|-- NonSendAction
SendAction <|-- SendStringAction
SendAction <|-- SendCharAction
SendAction <|-- SendKeyAction
SendAction <|-- SendMediaKeyAction
NonSendAction <|-- DelayedAction
NonSendAction <|-- SerialOutputAction
NonSendAction <|-- SerialAction

Component table

Component File Pattern Responsibility
main.cpp src/main.cpp Composition root Wires all components together; owns the main loop
EventDispatcher include/event_dispatcher.h Observer Registers button handlers; dispatches button presses to the correct action
ProfileManager include/profile_manager.h Strategy + Composite Stores per-profile action sets; handles profile switching and LED feedback
Action hierarchy lib/PedalLogic/include/ Strategy Polymorphic actions executed on button press
LEDController lib/hardware/esp32/ Adapter Abstracts LED GPIO
ButtonController lib/hardware/esp32/ Adapter Abstracts button GPIO with debounce
BleKeyboardAdapter lib/hardware/esp32/ Adapter Wraps the ESP32 BLE Keyboard library behind IBleKeyboard
ConfigLoader lib/PedalLogic/src/config_loader.cpp Reads pedal_config.json from LittleFS and builds the action graph

Hardware abstraction seam

The codebase is split into hardware-independent logic (lib/PedalLogic) and hardware-specific drivers (lib/hardware/esp32, lib/hardware/nrf52840).

The seam is defined by three interface classes:

Hardware-independent code (EventDispatcher, ProfileManager, Action hierarchy) depends only on these interfaces. Platform-specific code implements them.

The HOST_TEST_BUILD preprocessor flag enables building the logic layer on a development machine without any ESP32 or Arduino dependencies. When this flag is set, Arduino-specific headers are replaced by test/fakes/arduino_shim.h, and hardware implementations are replaced by mock classes from test/mocks/.

This means the full logic of the pedal can be tested with GoogleTest on any machine, without hardware.

Memory management

  • All dynamic memory is managed via std::unique_ptr.
  • RAII: resources are acquired in constructors and released automatically in destructors.
  • No raw new or delete in application code.