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,38 @@
|
||||
#include "switch_stub.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
DefaultSwitchStub::DefaultSwitchStub() : initialized(false) {
|
||||
for (int i = 0; i < NUM_SWITCHES; i++) {
|
||||
switch_states[i].id = i;
|
||||
switch_states[i].gpio_pin = 0;
|
||||
switch_states[i].current_state = false;
|
||||
switch_states[i].previous_state = false;
|
||||
switch_states[i].last_change_time = 0;
|
||||
switch_states[i].debounce_time = 50;
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultSwitchStub::begin() {
|
||||
initialized = true;
|
||||
Serial.println("[SW] Stub initialized (GPIO pins not configured yet)");
|
||||
}
|
||||
|
||||
bool DefaultSwitchStub::is_pressed(uint8_t switch_id) {
|
||||
if (!initialized || switch_id >= NUM_SWITCHES) {
|
||||
return false;
|
||||
}
|
||||
return switch_states[switch_id].current_state;
|
||||
}
|
||||
|
||||
void DefaultSwitchStub::configure_switch(uint8_t switch_id, uint8_t gpio_pin) {
|
||||
if (switch_id >= NUM_SWITCHES) return;
|
||||
switch_states[switch_id].gpio_pin = gpio_pin;
|
||||
Serial.printf("[SW] Switch %d configured to GPIO %d\n", switch_id, gpio_pin);
|
||||
}
|
||||
|
||||
void DefaultSwitchStub::set_debounce_time(uint32_t time_ms) {
|
||||
for (int i = 0; i < NUM_SWITCHES; i++) {
|
||||
switch_states[i].debounce_time = time_ms;
|
||||
}
|
||||
Serial.printf("[SW] Debounce time set to %lu ms\n", time_ms);
|
||||
}
|
||||
Reference in New Issue
Block a user