X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/9798440ca4f694e7cd8312a51b82e59589f1ebeb..d0db78432fc02bacbd57cc9f15eb05b4e56981cb:/Demos/Device/ClassDriver/MIDI/MIDI.c?ds=sidebyside diff --git a/Demos/Device/ClassDriver/MIDI/MIDI.c b/Demos/Device/ClassDriver/MIDI/MIDI.c index 234adca25..a6c31ee47 100644 --- a/Demos/Device/ClassDriver/MIDI/MIDI.c +++ b/Demos/Device/ClassDriver/MIDI/MIDI.c @@ -40,15 +40,23 @@ * passed to all MIDI Class driver functions, so that multiple instances of the same class * within a device can be differentiated from one another. */ -USB_ClassInfo_MIDI_t Keyboard_MIDI_Interface = +USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface = { - .StreamingInterfaceNumber = 1, + .Config = + { + .StreamingInterfaceNumber = 1, - .DataINEndpointNumber = MIDI_STREAM_IN_EPNUM, - .DataINEndpointSize = MIDI_STREAM_EPSIZE, + .DataINEndpointNumber = MIDI_STREAM_IN_EPNUM, + .DataINEndpointSize = MIDI_STREAM_EPSIZE, - .DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM, - .DataOUTEndpointSize = MIDI_STREAM_EPSIZE, + .DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM, + .DataOUTEndpointSize = MIDI_STREAM_EPSIZE, + }, + + .State = + { + // Leave all state values to their defaults + } }; /** Main program entry point. This routine contains the overall program flow, including initial @@ -64,7 +72,7 @@ int main(void) { CheckJoystickMovement(); - USB_MIDI_EventPacket_t DummyMIDIEvent; + MIDI_EventPacket_t DummyMIDIEvent; MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &DummyMIDIEvent); MIDI_Device_USBTask(&Keyboard_MIDI_Interface); @@ -136,12 +144,12 @@ void CheckJoystickMovement(void) if (MIDICommand) { - USB_MIDI_EventPacket_t MIDIEvent = (USB_MIDI_EventPacket_t) + MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t) { .CableNumber = 0, - .Command = MIDICommand, + .Command = (MIDICommand >> 4), - .Data1 = (MIDICommand << 4) | Channel, + .Data1 = MIDICommand | Channel, .Data2 = MIDIPitch, .Data3 = MIDI_STANDARD_VELOCITY, };