Files
loopy_midi_controller/components/hal/led_stub.h
T
ash 458cb5060f Fix Phase 1 skeleton: add build system, fix compilation errors
- Add CMakeLists.txt for project and all components
- Add idf_component.yml with TinyUSB dependency
- Create switch_stub.cpp implementation
- Fix app_task.h to match .cpp implementation (2-param signature)
- Fix led_stub.h/cpp class naming (DefaultLedStub)
- Fix midi_transport.cpp TinyUSB API usage (tud_midi_*)
- Move main.cpp to main/ directory
- Add sdkconfig.defaults for ESP32-S3
2026-06-23 08:59:53 +00:00

42 lines
1.0 KiB
C++

// components/hal/led_stub.h
#pragma once
#include <cstdint>
class LedStub {
public:
virtual ~LedStub() {}
virtual void begin() = 0;
virtual void set_led_state(uint8_t note, uint8_t channel, uint8_t velocity) = 0;
virtual void clear_all() = 0;
// Helper function to map MIDI note to LED index
virtual uint8_t note_to_index(uint8_t note) {
return note;
}
};
// LED state structure
struct LedState {
uint8_t note; // Launchpad note
uint8_t channel; // LED channel (1-3)
uint8_t velocity; // Color/brightness (0-127)
uint32_t timestamp; // When state was set
bool active; // Current on/off state
};
// Default stub implementation
class DefaultLedStub : public LedStub {
private:
static const uint8_t NUM_LEDS = 10;
LedState led_states[NUM_LEDS];
bool initialized;
public:
DefaultLedStub();
void begin() override;
void set_led_state(uint8_t note, uint8_t channel, uint8_t velocity) override;
void clear_all() override;
};