Leonardo LEDs are RX/TX active Low and USER active high, not the other way around.
[pub/USBasp.git] / Demos / Host / ClassDriver / MIDIHost / MIDIHost.c
index 129bd3d..04a9454 100644 (file)
@@ -101,7 +101,7 @@ void SetupHardware(void)
 }
 
 /** Task to manage an enumerated USB MIDI device once connected, to display received
- *  note events from the host and send note changes in response to tbe board's joystick.
+ *  note events from the host and send note changes in response to the board's joystick.
  */
 void JoystickHost_Task(void)
 {
@@ -111,8 +111,8 @@ void JoystickHost_Task(void)
        MIDI_EventPacket_t MIDIEvent;
        while (MIDI_Host_ReceiveEventPacket(&Keyboard_MIDI_Interface, &MIDIEvent))
        {
-               bool NoteOnEvent  = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_ON  >> 4));
-               bool NoteOffEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_OFF >> 4));
+               bool NoteOnEvent  = (MIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_ON));
+               bool NoteOffEvent = (MIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_OFF));
 
                /* Display note events from the host */
                if (NoteOnEvent || NoteOffEvent)
@@ -173,8 +173,7 @@ void CheckJoystickMovement(void)
        {
                MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
                        {
-                               .CableNumber = 0,
-                               .Command     = (MIDICommand >> 4),
+                               .Event       = MIDI_EVENT(0, MIDICommand),
 
                                .Data1       = MIDICommand | Channel,
                                .Data2       = MIDIPitch,