Loop in the ClassDriver MIDI device/host demos until there are no more incomming...
[pub/USBasp.git] / Demos / Device / ClassDriver / MIDI / MIDI.c
index 217a3a4..95a2ddd 100644 (file)
@@ -71,7 +71,7 @@ int main(void)
                CheckJoystickMovement();
 
                MIDI_EventPacket_t ReceivedMIDIEvent;
-               if (MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &ReceivedMIDIEvent))
+               while (MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &ReceivedMIDIEvent))
                {
                        if ((ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4)) && (ReceivedMIDIEvent.Data3 > 0))
                          LEDs_SetAllLEDs(ReceivedMIDIEvent.Data2 > 64 ? LEDS_LED1 : LEDS_LED2);