Removed mostly useless "TestApp" demo, as it was mainly useful only for checking...
[pub/USBasp.git] / Demos / Device / ClassDriver / MIDI / MIDI.c
index f1a0d9a..d50a254 100644 (file)
@@ -67,9 +67,14 @@ int main(void)
        {\r
                CheckJoystickMovement();\r
                \r
-               /* Must acknowedge MIDI packets from the host even though they aren't used, or the host locks up */\r
-               MIDI_EventPacket_t DummyMIDIEvent;\r
-               MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &DummyMIDIEvent);\r
+               MIDI_EventPacket_t ReceivedMIDIEvent;\r
+               if (MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &ReceivedMIDIEvent))\r
+               {\r
+                       if (ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4))\r
+                         LEDs_SetAllLEDs(ReceivedMIDIEvent.Data2 > 64 ? LEDS_LED1 : LEDS_LED2);\r
+                       else\r
+                         LEDs_SetAllLEDs(LEDS_NO_LEDS);\r
+               }\r
        \r
                MIDI_Device_USBTask(&Keyboard_MIDI_Interface);\r
                USB_USBTask();\r