Fix USB MIDI, add LED startup animation, improve logging
- Use ArduinoUSBMIDI library for proper USB MIDI device recognition - Add LED startup colour cycle (red, green, blue, yellow, magenta, cyan, white) - Add comprehensive console logging for all MIDI in/out and switch events - Log unmapped MIDI messages
This commit is contained in:
@@ -15,10 +15,10 @@ struct MidiEvent {
|
||||
SYSEX
|
||||
} type;
|
||||
|
||||
uint8_t channel; // MIDI channel (1-16)
|
||||
uint8_t data1; // Note number or CC number
|
||||
uint8_t data2; // Velocity or CC value
|
||||
uint32_t timestamp; // Event timestamp
|
||||
uint8_t channel;
|
||||
uint8_t data1;
|
||||
uint8_t data2;
|
||||
uint32_t timestamp;
|
||||
};
|
||||
|
||||
class UsbMidiTransport {
|
||||
@@ -29,17 +29,15 @@ public:
|
||||
bool begin();
|
||||
void update();
|
||||
|
||||
// Callback registration
|
||||
void on_midi_receive(std::function<void(const MidiEvent&)> callback);
|
||||
|
||||
// Send MIDI
|
||||
void send_note_on(uint8_t channel, uint8_t note, uint8_t velocity);
|
||||
void send_note_off(uint8_t channel, uint8_t note, uint8_t velocity);
|
||||
void send_cc(uint8_t channel, uint8_t cc, uint8_t value);
|
||||
|
||||
bool is_connected();
|
||||
|
||||
private:
|
||||
std::function<void(const MidiEvent&)> receive_callback;
|
||||
bool initialized;
|
||||
|
||||
void parse_midi_packet(const uint8_t* buffer, uint32_t size, MidiEvent& event);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user