@@ -64,6 +64,37 @@ class Serial_ : public Stream
6464};
6565extern Serial_ SerialUSB;
6666
67+
68+ // Gurbrinder: Midi Interface
69+ // ================================================================================
70+ // ================================================================================
71+ // MIDI USB class
72+
73+ typedef struct
74+ {
75+ uint8_t header;
76+ uint8_t byte1;
77+ uint8_t byte2;
78+ uint8_t byte3;
79+ }midiEventPacket_t;
80+
81+ class MIDI_
82+ {
83+ private:
84+ RingBuffer *_midi_rx_buffer;
85+ public:
86+ void begin ();
87+
88+ virtual uint32_t available (void );
89+ virtual void accept (void );
90+ virtual midiEventPacket_t read (void );
91+ virtual void flush (void );
92+ virtual void sendMIDI (midiEventPacket_t event);
93+ virtual size_t write (const uint8_t *buffer, size_t size);
94+ operator bool ();
95+ };
96+ extern MIDI_ MidiUSB;
97+
6798// ================================================================================
6899// ================================================================================
69100// Mouse
@@ -196,6 +227,15 @@ int CDC_GetOtherInterface(uint8_t* interfaceNum);
196227int CDC_GetDescriptor (int i);
197228bool CDC_Setup (Setup& setup);
198229
230+ // ================================================================================
231+ // ================================================================================
232+ // MIDI 'Driver'
233+
234+ int MIDI_GetInterface (uint8_t * interfaceNum);
235+ int MIDI_GetOtherInterface (uint8_t * interfaceNum);
236+ int MIDI_GetDescriptor (int i);
237+ bool MIDI_Setup (Setup& setup);
238+
199239// ================================================================================
200240// ================================================================================
201241
0 commit comments