Convert to PlatformIO/Arduino format

- Replace ESP-IDF structure with PlatformIO (platformio.ini)
- Move source files to src/ and include/
- Move libraries to lib/ directory
- Replace FreeRTOS with Arduino task/vTaskDelay
- Use Arduino MIDI library instead of raw TinyUSB
- Dual-core: MIDI on core 0, controller on core 1
This commit is contained in:
2026-06-23 12:55:12 +00:00
parent 458cb5060f
commit 9078001404
20 changed files with 341 additions and 355 deletions
+69
View File
@@ -0,0 +1,69 @@
// Loopy MIDI Controller - Phase 1
// ESP32-S3 USB MIDI Foot Controller
#include <Arduino.h>
#include "midi_transport.h"
#include "led_stub.h"
#include "switch_stub.h"
#include "app_task.h"
// Hardware instances
DefaultLedStub led_driver;
DefaultSwitchStub switch_driver;
UsbMidiTransport midi_transport;
// Controller task
AppTask controller(&led_driver, &switch_driver, &midi_transport);
// FreeRTOS task handles
TaskHandle_t midi_task_handle = NULL;
// MIDI processing task (runs on core 0)
void midi_task(void* parameter) {
Serial.println("[TASK] MIDI task started on core 0");
while (true) {
midi_transport.update();
vTaskDelay(1); // Yield to other tasks
}
}
void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("=============================");
Serial.println("Loopy MIDI Controller v0.1");
Serial.println("Phase 1: USB MIDI");
Serial.println("=============================");
// Initialize hardware stubs
led_driver.begin();
switch_driver.begin();
// Initialize MIDI transport
midi_transport.begin();
// Initialize controller
controller.begin();
// Create MIDI task on core 0 (high priority)
xTaskCreatePinnedToCore(
midi_task,
"midi_task",
4096,
NULL,
3,
&midi_task_handle,
0
);
Serial.println("[INIT] All systems ready");
Serial.println("=============================");
}
void loop() {
// Controller task runs on core 1 (main Arduino loop)
controller.update();
delay(10); // 10ms loop period
}