Initial commit: Phase 1 skeleton
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
// main.cpp - Entry point for ESP32-S3 FreeRTOS application
|
||||
// Phase 1: USB MIDI + Basic Event Processing
|
||||
|
||||
#include <stdio.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_log.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
// Component includes
|
||||
#include "midi/midi_transport.h"
|
||||
#include "controller/app_task.h"
|
||||
#include "hal/led_stub.h"
|
||||
#include "hal/switch_stub.h"
|
||||
|
||||
// Logging tag
|
||||
static const char *TAG = "loopy_midi_controller";
|
||||
|
||||
// FreeRTOS task handles
|
||||
static TaskHandle_t usb_midi_task_handle = NULL;
|
||||
static TaskHandle_t controller_task_handle = NULL;
|
||||
|
||||
extern "C" void app_main(void) {
|
||||
ESP_LOGI(TAG, "Starting Loopy MIDI Controller (Phase 1)");
|
||||
ESP_LOGI(TAG, "Device name: Loopy Foot Controller");
|
||||
|
||||
// Initialize hardware stubs (Phase 1 - no real hardware yet)
|
||||
LedStub led_driver;
|
||||
SwitchStub switch_driver;
|
||||
|
||||
led_driver.begin();
|
||||
switch_driver.begin();
|
||||
|
||||
// Initialize MIDI transport (USB)
|
||||
UsbMidiTransport midi_transport;
|
||||
midi_transport.begin();
|
||||
|
||||
// Create USB MIDI task (High priority)
|
||||
BaseType_t usb_midi_result = xTaskCreate(
|
||||
usb_midi_task,
|
||||
"usb_midi_task",
|
||||
4096,
|
||||
(void*)&midi_transport,
|
||||
tskIDLE_PRIORITY + 3,
|
||||
&usb_midi_task_handle
|
||||
);
|
||||
|
||||
if (usb_midi_result != pdPASS) {
|
||||
ESP_LOGE(TAG, "Failed to create USB MIDI task");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create Controller task (Lower priority)
|
||||
AppTaskParams app_params;
|
||||
app_params.led_driver = &led_driver;
|
||||
app_params.switch_driver = &switch_driver;
|
||||
app_params.midi_queue = midi_transport.get_event_queue();
|
||||
|
||||
BaseType_t controller_result = xTaskCreate(
|
||||
app_task,
|
||||
"controller_task",
|
||||
4096,
|
||||
(void*)&app_params,
|
||||
tskIDLE_PRIORITY + 1,
|
||||
&controller_task_handle
|
||||
);
|
||||
|
||||
if (controller_result != pdPASS) {
|
||||
ESP_LOGE(TAG, "Failed to create Controller task");
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Loopy MIDI Controller initialized successfully");
|
||||
ESP_LOGI(TAG, "Phase 1 complete: USB MIDI device ready");
|
||||
}
|
||||
Reference in New Issue
Block a user