b5bbe24977
- Parse all SysEx CIN types (start, continue, end) - Reassemble multi-packet SysEx messages - Handle layout select (Programmer mode = 0x7F) - Handle Programmer/Live mode switch
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include "midi_transport.h"
|
|
#include "led_stub.h"
|
|
#include "switch_stub.h"
|
|
|
|
struct PadMapping {
|
|
uint8_t physical_switch;
|
|
uint8_t midi_channel;
|
|
uint8_t midi_note;
|
|
uint8_t led_index;
|
|
};
|
|
|
|
class AppTask {
|
|
public:
|
|
AppTask(LedStub* led, SwitchStub* sw, UsbMidiTransport* midi);
|
|
|
|
void begin();
|
|
void update();
|
|
void process_midi_event(const MidiEvent& event); // public for test commands
|
|
|
|
private:
|
|
LedStub* led_driver;
|
|
SwitchStub* switch_driver;
|
|
UsbMidiTransport* midi_transport;
|
|
|
|
static const uint8_t NUM_PADS = 10;
|
|
PadMapping pad_mapping[NUM_PADS];
|
|
bool last_switch_state[NUM_PADS];
|
|
|
|
// SysEx reassembly buffer
|
|
static const uint8_t SYSEX_MAX_LEN = 64;
|
|
uint8_t sysex_buffer[SYSEX_MAX_LEN];
|
|
uint8_t sysex_len = 0;
|
|
bool sysex_active = false;
|
|
|
|
void process_switch_event(uint8_t switch_id, bool pressed);
|
|
void run_palette_test();
|
|
void handle_sysex(const uint8_t* data, uint8_t len);
|
|
void process_sysex_packet(const uint8_t* packet, uint8_t cin);
|
|
};
|