Pipe_GetErrorFlags() now returns additional error flags for overflow and underflow errors.

Change MIDI demos to use real MIDI command values, and shift for the USB wrapper, rather than shift for the MIDI bytes. This is a little confusing for the MIDI USB wrapper, but allows for the use of real standardized MIDI command values.
pull/1469/head
Dean Camera 16 years ago
parent 39d07c3da0
commit dcf303762a

@ -139,9 +139,9 @@ void CheckJoystickMovement(void)
USB_MIDI_EventPacket_t MIDIEvent = (USB_MIDI_EventPacket_t) USB_MIDI_EventPacket_t MIDIEvent = (USB_MIDI_EventPacket_t)
{ {
.CableNumber = 0, .CableNumber = 0,
.Command = MIDICommand, .Command = (MIDICommand >> 4),
.Data1 = (MIDICommand << 4) | Channel, .Data1 = MIDICommand | Channel,
.Data2 = MIDIPitch, .Data2 = MIDIPitch,
.Data3 = MIDI_STANDARD_VELOCITY, .Data3 = MIDI_STANDARD_VELOCITY,
}; };

@ -168,9 +168,9 @@ void MIDI_Task(void)
USB_MIDI_EventPacket_t MIDIEvent = (USB_MIDI_EventPacket_t) USB_MIDI_EventPacket_t MIDIEvent = (USB_MIDI_EventPacket_t)
{ {
.CableNumber = 0, .CableNumber = 0,
.Command = MIDICommand, .Command = (MIDICommand >> 4),
.Data1 = (MIDICommand << 4) | Channel, .Data1 = MIDICommand | Channel,
.Data2 = MIDIPitch, .Data2 = MIDIPitch,
.Data3 = MIDI_STANDARD_VELOCITY, .Data3 = MIDI_STANDARD_VELOCITY,
}; };

@ -52,10 +52,10 @@
/* Macros: */ /* Macros: */
/** MIDI command for a note on (activation) event */ /** 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 */ /** 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 */ /** 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

@ -60,10 +60,10 @@
#define MIDI_JACKTYPE_EXTERNAL 0x02 #define MIDI_JACKTYPE_EXTERNAL 0x02
/** MIDI command for a note on (activation) event */ /** 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 */ /** 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 */ /** Standard key press velocity value used for all note events */
#define MIDI_STANDARD_VELOCITY 64 #define MIDI_STANDARD_VELOCITY 64

@ -77,6 +77,12 @@
/* Public Interface - May be used in end-application: */ /* Public Interface - May be used in end-application: */
/* Macros: */ /* 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. */ /** Mask for \ref Pipe_GetErrorFlags(), indicating that a CRC error occurred in the pipe on the received data. */
#define PIPE_ERRORFLAG_CRC16 (1 << 4) #define PIPE_ERRORFLAG_CRC16 (1 << 4)
@ -426,7 +432,10 @@
#define Pipe_ClearErrorFlags() MACROS{ UPERRX = 0; }MACROE #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) #define Pipe_IsReadWriteAllowed() ((UPINTX & (1 << RWAL)) ? true : false)

@ -21,6 +21,7 @@
* - Added new USB_Host_SetDeviceConfiguration() convenience function for easy configuration selection of devices while in USB * - Added new USB_Host_SetDeviceConfiguration() convenience function for easy configuration selection of devices while in USB
* host mode * host mode
* - Added USB Missle Launcher project, submitted by Dave Fletcher * - 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 * \section Sec_ChangeLog090605 Version 090605

Loading…
Cancel
Save