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:
@@ -0,0 +1,45 @@
|
||||
#include "led_stub.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
DefaultLedStub::DefaultLedStub() : initialized(false) {
|
||||
for (int i = 0; i < NUM_LEDS; i++) {
|
||||
led_states[i].active = false;
|
||||
led_states[i].velocity = 0;
|
||||
led_states[i].note = 0;
|
||||
led_states[i].channel = 0;
|
||||
led_states[i].timestamp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultLedStub::begin() {
|
||||
initialized = true;
|
||||
Serial.println("[LED] Stub initialized (GPIO pins not configured yet)");
|
||||
}
|
||||
|
||||
void DefaultLedStub::set_led_state(uint8_t note, uint8_t channel, uint8_t velocity) {
|
||||
if (!initialized) return;
|
||||
|
||||
uint8_t led_index = note_to_index(note);
|
||||
|
||||
if (led_index < NUM_LEDS) {
|
||||
led_states[led_index].note = note;
|
||||
led_states[led_index].channel = channel;
|
||||
led_states[led_index].velocity = velocity;
|
||||
led_states[led_index].active = (velocity > 0);
|
||||
led_states[led_index].timestamp = millis();
|
||||
|
||||
Serial.printf("[LED] Note %d -> LED %d Ch %d Vel %d (%s)\n",
|
||||
note, led_index, channel, velocity,
|
||||
velocity > 0 ? "ON" : "OFF");
|
||||
} else {
|
||||
Serial.printf("[LED] Index out of range: %d (Note: %d)\n", led_index, note);
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultLedStub::clear_all() {
|
||||
for (int i = 0; i < NUM_LEDS; i++) {
|
||||
led_states[i].active = false;
|
||||
led_states[i].velocity = 0;
|
||||
}
|
||||
Serial.println("[LED] All LEDs cleared");
|
||||
}
|
||||
Reference in New Issue
Block a user