diff --git a/Demos/Device/ClassDriver/MIDI/MIDI.c b/Demos/Device/ClassDriver/MIDI/MIDI.c index 234adca25a9141636ecc69fe3c2c116ee2f0c292..511f280d6cb2883864e4e54acc6c1980bf80ef94 100644 --- a/Demos/Device/ClassDriver/MIDI/MIDI.c +++ b/Demos/Device/ClassDriver/MIDI/MIDI.c @@ -139,9 +139,9 @@ void CheckJoystickMovement(void) USB_MIDI_EventPacket_t MIDIEvent = (USB_MIDI_EventPacket_t) { .CableNumber = 0, - .Command = MIDICommand, + .Command = (MIDICommand >> 4), - .Data1 = (MIDICommand << 4) | Channel, + .Data1 = MIDICommand | Channel, .Data2 = MIDIPitch, .Data3 = MIDI_STANDARD_VELOCITY, }; diff --git a/Demos/Device/LowLevel/MIDI/MIDI.c b/Demos/Device/LowLevel/MIDI/MIDI.c index c74d8d5341b45f6e90e248767076a500c86ac30f..84d3778545195756c221a845b6c67deb2af0841d 100644 --- a/Demos/Device/LowLevel/MIDI/MIDI.c +++ b/Demos/Device/LowLevel/MIDI/MIDI.c @@ -168,9 +168,9 @@ void MIDI_Task(void) USB_MIDI_EventPacket_t MIDIEvent = (USB_MIDI_EventPacket_t) { .CableNumber = 0, - .Command = MIDICommand, + .Command = (MIDICommand >> 4), - .Data1 = (MIDICommand << 4) | Channel, + .Data1 = MIDICommand | Channel, .Data2 = MIDIPitch, .Data3 = MIDI_STANDARD_VELOCITY, }; diff --git a/Demos/Device/LowLevel/MIDI/MIDI.h b/Demos/Device/LowLevel/MIDI/MIDI.h index 1558501a7ca6e4aa11c1a76c75ce5cef5a299aff..735ac84427bb2c5e212e11bafa981078b86f27fb 100644 --- a/Demos/Device/LowLevel/MIDI/MIDI.h +++ b/Demos/Device/LowLevel/MIDI/MIDI.h @@ -52,20 +52,20 @@ /* Macros: */ /** MIDI command for a note on (activation) event */ - #define MIDI_COMMAND_NOTE_ON 0x09 + #define MIDI_COMMAND_NOTE_ON 0x90 /** MIDI command for a note off (deactivation) event */ - #define MIDI_COMMAND_NOTE_OFF 0x08 + #define MIDI_COMMAND_NOTE_OFF 0x80 /** Standard key press velocity value used for all note events, as no pressure sensor is mounted */ - #define MIDI_STANDARD_VELOCITY 64 + #define MIDI_STANDARD_VELOCITY 64 /** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel * addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address. * * \param channel MIDI channel number to address */ - #define MIDI_CHANNEL(channel) (channel - 1) + #define MIDI_CHANNEL(channel) (channel - 1) /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ #define LEDMASK_USB_NOTREADY LEDS_LED1 diff --git a/LUFA/Drivers/USB/Class/Common/MIDI.h b/LUFA/Drivers/USB/Class/Common/MIDI.h index 05bd846301d4e5ec28413c42520bbd0893e93652..f768ba238dbcac1afb48900e29f245cbdebe1b80 100644 --- a/LUFA/Drivers/USB/Class/Common/MIDI.h +++ b/LUFA/Drivers/USB/Class/Common/MIDI.h @@ -60,10 +60,10 @@ #define MIDI_JACKTYPE_EXTERNAL 0x02 /** MIDI command for a note on (activation) event */ - #define MIDI_COMMAND_NOTE_ON 0x09 + #define MIDI_COMMAND_NOTE_ON 0x90 /** MIDI command for a note off (deactivation) event */ - #define MIDI_COMMAND_NOTE_OFF 0x08 + #define MIDI_COMMAND_NOTE_OFF 0x80 /** Standard key press velocity value used for all note events */ #define MIDI_STANDARD_VELOCITY 64 diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h index f3da9d1cef00ca3a2bc86a1adedaeebede66749a..62cbe65a227884d5c3c86c39505c6f63360635fb 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.h +++ b/LUFA/Drivers/USB/LowLevel/Pipe.h @@ -77,6 +77,12 @@ /* Public Interface - May be used in end-application: */ /* Macros: */ + /** Mask for \ref Pipe_GetErrorFlags(), indicating that an overflow error occurred in the pipe on the received data. */ + #define PIPE_ERRORFLAG_OVERFLOW (1 << 6) + + /** Mask for \ref Pipe_GetErrorFlags(), indicating that an underflow error occurred in the pipe on the received data. */ + #define PIPE_ERRORFLAG_UNDERFLOW (1 << 5) + /** Mask for \ref Pipe_GetErrorFlags(), indicating that a CRC error occurred in the pipe on the received data. */ #define PIPE_ERRORFLAG_CRC16 (1 << 4) @@ -426,7 +432,10 @@ #define Pipe_ClearErrorFlags() MACROS{ UPERRX = 0; }MACROE - #define Pipe_GetErrorFlags() UPERRX + #define Pipe_GetErrorFlags() ((UPERRX & (PIPE_ERRORFLAG_CRC16 | PIPE_ERRORFLAG_TIMEOUT | \ + PIPE_ERRORFLAG_PID | PIPE_ERRORFLAG_DATAPID | \ + PIPE_ERRORFLAG_DATATGL)) | \ + (UPSTAX & PIPE_ERRORFLAG_OVERFLOW | PIPE_ERRORFLAG_UNDERFLOW)) #define Pipe_IsReadWriteAllowed() ((UPINTX & (1 << RWAL)) ? true : false) diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 6343d3f7cb556741575bd00cda3804e7fcb7dcba..b3d533d72563d1cabdf1f28d549e10076c18d79c 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -21,6 +21,7 @@ * - Added new USB_Host_SetDeviceConfiguration() convenience function for easy configuration selection of devices while in USB * host mode * - Added USB Missle Launcher project, submitted by Dave Fletcher + * - Pipe_GetErrorFlags() now returns additional error flags for overflow and underflow errors * * * \section Sec_ChangeLog090605 Version 090605 diff --git a/Projects/MissleLauncher/MissileLauncher.c b/Projects/MissleLauncher/MissileLauncher.c index cb12e2aab2afd346d9616497a9ad0329d2040674..e70187be5c821f17ed391bcaf1a9eb4af7ee8ff9 100644 --- a/Projects/MissleLauncher/MissileLauncher.c +++ b/Projects/MissleLauncher/MissileLauncher.c @@ -64,8 +64,8 @@ uint8_t CMD_LEFTDOWN[8] = { 0, 1, 0, 0, 1, 0, 8, 8 }; uint8_t CMD_RIGHTDOWN[8] = { 0, 0, 1, 0, 1, 0, 8, 8 }; uint8_t CMD_FIRE[8] = { 0, 0, 0, 0, 0, 1, 8, 8 }; -uint8_t *CmdState; -uint8_t CmdBuffer[LAUNCHER_CMD_BUFFER_SIZE]; +uint8_t* CmdState; +uint8_t CmdBuffer[LAUNCHER_CMD_BUFFER_SIZE]; /** Main program entry point. This routine configures the hardware required by the application, then * starts the scheduler to run the application tasks.