Error status LEDs shown when device endpoint configuration fails to complete.
authorDean Camera <dean@fourwalledcubicle.com>
Mon, 8 Jun 2009 07:46:07 +0000 (07:46 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Mon, 8 Jun 2009 07:46:07 +0000 (07:46 +0000)
MIDI device demo no longer blocks if a note change event is sent while the endpoint is not ready.

14 files changed:
Demos/Device/LowLevel/AudioInput/AudioInput.c
Demos/Device/LowLevel/AudioOutput/AudioOutput.c
Demos/Device/LowLevel/CDC/CDC.c
Demos/Device/LowLevel/DualCDC/DualCDC.c
Demos/Device/LowLevel/GenericHID/GenericHID.c
Demos/Device/LowLevel/Joystick/Joystick.c
Demos/Device/LowLevel/Keyboard/Keyboard.c
Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c
Demos/Device/LowLevel/MIDI/MIDI.c
Demos/Device/LowLevel/MassStorage/MassStorage.c
Demos/Device/LowLevel/Mouse/Mouse.c
Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c
Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c
LUFA/ChangeLog.txt

index 7757ef1..50e7f4d 100644 (file)
@@ -109,13 +109,16 @@ void EVENT_USB_Disconnect(void)
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
-       /* Setup audio stream endpoint */\r
-       Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,\r
-                                      ENDPOINT_DIR_IN, AUDIO_STREAM_EPSIZE,\r
-                                  ENDPOINT_BANK_DOUBLE);\r
-\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+\r
+       /* Setup audio stream endpoint */\r
+       if (!(Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,\r
+                                            ENDPOINT_DIR_IN, AUDIO_STREAM_EPSIZE,\r
+                                        ENDPOINT_BANK_DOUBLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
index 7a9c6ec..07418d5 100644 (file)
@@ -136,13 +136,16 @@ void EVENT_USB_Disconnect(void)
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
-       /* Setup audio stream endpoint */\r
-       Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,\r
-                                      ENDPOINT_DIR_OUT, AUDIO_STREAM_EPSIZE,\r
-                                  ENDPOINT_BANK_DOUBLE);\r
-\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+\r
+       /* Setup audio stream endpoint */\r
+       if (!(Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,\r
+                                            ENDPOINT_DIR_OUT, AUDIO_STREAM_EPSIZE,\r
+                                        ENDPOINT_BANK_DOUBLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
index 3db4c1e..9934389 100644 (file)
@@ -105,21 +105,30 @@ void EVENT_USB_Disconnect(void)
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
-       /* Setup CDC Notification, Rx and Tx Endpoints */\r
-       Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,\r
-                                      ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,\r
-                                      ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+\r
+       /* Setup CDC Notification, Rx and Tx Endpoints */\r
+       if (!(Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
+       if (!(Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,\r
+                                            ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
+       if (!(Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,\r
+                                            ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
index 839d6d9..1031068 100644 (file)
@@ -116,35 +116,53 @@ void EVENT_USB_Disconnect(void)
  *  of the USB device after enumeration - the device endpoints are configured and the CDC management tasks are started.\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
  *  of the USB device after enumeration - the device endpoints are configured and the CDC management tasks are started.\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
-{\r
-       /* Setup CDC Notification, Rx and Tx Endpoints for the first CDC */\r
-       Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       Endpoint_ConfigureEndpoint(CDC1_TX_EPNUM, EP_TYPE_BULK,\r
-                                      ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       Endpoint_ConfigureEndpoint(CDC1_RX_EPNUM, EP_TYPE_BULK,\r
-                                      ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       /* Setup CDC Notification, Rx and Tx Endpoints for the second CDC */\r
-       Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       Endpoint_ConfigureEndpoint(CDC2_TX_EPNUM, EP_TYPE_BULK,\r
-                                      ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       Endpoint_ConfigureEndpoint(CDC2_RX_EPNUM, EP_TYPE_BULK,\r
-                                      ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-                                                          \r
+{                                                         \r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+\r
+       /* Setup CDC Notification, Rx and Tx Endpoints for the first CDC */\r
+       if (!(Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
+       if (!(Endpoint_ConfigureEndpoint(CDC1_TX_EPNUM, EP_TYPE_BULK,\r
+                                            ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
+       if (!(Endpoint_ConfigureEndpoint(CDC1_RX_EPNUM, EP_TYPE_BULK,\r
+                                            ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
+       /* Setup CDC Notification, Rx and Tx Endpoints for the second CDC */\r
+       if (!(Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
+       if (!(Endpoint_ConfigureEndpoint(CDC2_TX_EPNUM, EP_TYPE_BULK,\r
+                                            ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
+       if (!(Endpoint_ConfigureEndpoint(CDC2_RX_EPNUM, EP_TYPE_BULK,\r
+                                            ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
index a604bbe..40de8b9 100644 (file)
@@ -94,18 +94,24 @@ void EVENT_USB_Disconnect(void)
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
-       /* Setup Generic IN Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(GENERIC_IN_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, GENERIC_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       /* Setup Generic OUT Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(GENERIC_OUT_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_OUT, GENERIC_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+\r
+       /* Setup Generic IN Report Endpoint */\r
+       if (!(Endpoint_ConfigureEndpoint(GENERIC_IN_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, GENERIC_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
+       /* Setup Generic OUT Report Endpoint */\r
+       if (!(Endpoint_ConfigureEndpoint(GENERIC_OUT_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_OUT, GENERIC_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
index 94763b8..0c018aa 100644 (file)
@@ -92,13 +92,16 @@ void EVENT_USB_Disconnect(void)
  */ \r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
  */ \r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
-       /* Setup Joystick Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(JOYSTICK_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, JOYSTICK_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+\r
+       /* Setup Joystick Report Endpoint */\r
+       if (!(Endpoint_ConfigureEndpoint(JOYSTICK_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, JOYSTICK_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
index 06806b5..35ef41b 100644 (file)
@@ -118,19 +118,25 @@ void EVENT_USB_Disconnect(void)
  *  of the USB device after enumeration, and configures the keyboard device endpoints.\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
  *  of the USB device after enumeration, and configures the keyboard device endpoints.\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
-{\r
-       /* Setup Keyboard Keycode Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(KEYBOARD_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, KEYBOARD_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       /* Setup Keyboard LED Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(KEYBOARD_LEDS_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_OUT, KEYBOARD_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
+{      \r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+\r
+       /* Setup Keyboard Keycode Report Endpoint */\r
+       if (!(Endpoint_ConfigureEndpoint(KEYBOARD_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, KEYBOARD_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
+       /* Setup Keyboard LED Report Endpoint */\r
+       if (!(Endpoint_ConfigureEndpoint(KEYBOARD_LEDS_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_OUT, KEYBOARD_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
index 9127fea..ddfe05a 100644 (file)
@@ -100,23 +100,32 @@ void EVENT_USB_Disconnect(void)
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
-       /* Setup Keyboard Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, HID_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
+       /* Indicate USB connected and ready */\r
+       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
 \r
 \r
+       /* Setup Keyboard Report Endpoint */\r
+       if (!(Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, HID_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
        /* Setup Keyboard LED Report Endpoint */\r
        /* Setup Keyboard LED Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_OUT, HID_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
+       if (!(Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_OUT, HID_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 \r
        /* Setup Mouse Report Endpoint */\r
 \r
        /* Setup Mouse Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, HID_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       /* Indicate USB connected and ready */\r
-       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+       if (!(Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, HID_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
index 6dd38af..856f7db 100644 (file)
@@ -90,17 +90,23 @@ void EVENT_USB_Disconnect(void)
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
-       /* Setup MIDI stream endpoints */\r
-       Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK,\r
-                                      ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK,\r
-                                      ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+\r
+       /* Setup MIDI stream endpoints */\r
+       if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK,\r
+                                            ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }       \r
+       \r
+       if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK,\r
+                                            ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Task to handle the generation of MIDI note change events in response to presses of the board joystick, and send them\r
 }\r
 \r
 /** Task to handle the generation of MIDI note change events in response to presses of the board joystick, and send them\r
@@ -159,8 +165,9 @@ void MIDI_Task(void)
  */\r
 void SendMIDINoteChange(const uint8_t Pitch, const bool OnOff, const uint8_t CableID, const uint8_t Channel)\r
 {\r
  */\r
 void SendMIDINoteChange(const uint8_t Pitch, const bool OnOff, const uint8_t CableID, const uint8_t Channel)\r
 {\r
-       /* Wait until endpoint ready for more data */\r
-       while (!(Endpoint_IsReadWriteAllowed()));\r
+       /* If endpoint ready for more data, abort */\r
+       if (!(Endpoint_IsReadWriteAllowed()))\r
+         return;\r
 \r
        /* Check if the message should be a Note On or Note Off command */\r
        uint8_t Command = ((OnOff)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);\r
 \r
        /* Check if the message should be a Note On or Note Off command */\r
        uint8_t Command = ((OnOff)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);\r
index 62c7f21..ee2a9d7 100644 (file)
@@ -106,17 +106,23 @@ void EVENT_USB_Disconnect(void)
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
+       /* Indicate USB connected and ready */\r
+       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+\r
        /* Setup Mass Storage In and Out Endpoints */\r
        /* Setup Mass Storage In and Out Endpoints */\r
-       Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK,\r
+       if (!(Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK,\r
                                       ENDPOINT_DIR_IN, MASS_STORAGE_IO_EPSIZE,\r
                                       ENDPOINT_DIR_IN, MASS_STORAGE_IO_EPSIZE,\r
-                                  ENDPOINT_BANK_DOUBLE);\r
-\r
-       Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPNUM, EP_TYPE_BULK,\r
+                                  ENDPOINT_BANK_DOUBLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
+       if (!(Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPNUM, EP_TYPE_BULK,\r
                                       ENDPOINT_DIR_OUT, MASS_STORAGE_IO_EPSIZE,\r
                                       ENDPOINT_DIR_OUT, MASS_STORAGE_IO_EPSIZE,\r
-                                  ENDPOINT_BANK_DOUBLE);\r
-\r
-       /* Indicate USB connected and ready */\r
-       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+                                  ENDPOINT_BANK_DOUBLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }                                                          \r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
index 4221536..c586b59 100644 (file)
@@ -119,13 +119,16 @@ void EVENT_USB_Disconnect(void)
  */ \r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
  */ \r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
-       /* Setup Mouse Report Endpoint */\r
-       Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, MOUSE_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+       \r
+       /* Setup Mouse Report Endpoint */\r
+       if (!(Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, MOUSE_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
index e651a1b..84fc5b4 100644 (file)
@@ -99,21 +99,30 @@ void EVENT_USB_Disconnect(void)
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
-       /* Setup CDC Notification, Rx and Tx Endpoints */\r
-       Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,\r
-                                      ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
+       /* Indicate USB connected and ready */\r
+       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
 \r
 \r
-       Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,\r
-                                      ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
+       /* Setup CDC Notification, Rx and Tx Endpoints */\r
+       if (!(Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,\r
+                                            ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }                                                          \r
 \r
 \r
-       Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
+       if (!(Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,\r
+                                            ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 \r
 \r
-       /* Indicate USB connected and ready */\r
-       LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+       if (!(Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
index ee4208f..3ed406d 100644 (file)
@@ -113,21 +113,30 @@ void EVENT_USB_Disconnect(void)
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
  */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
-       /* Setup CDC Notification, Rx and Tx Endpoints */\r
-       Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
-                                      ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,\r
-                                      ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
-       Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,\r
-                                      ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,\r
-                                  ENDPOINT_BANK_SINGLE);\r
-\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
        /* Indicate USB connected and ready */\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+\r
+       /* Setup CDC Notification, Rx and Tx Endpoints */\r
+       if (!(Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
+                                            ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
+       \r
+       if (!(Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,\r
+                                            ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }                                                          \r
+\r
+       if (!(Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,\r
+                                            ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,\r
+                                        ENDPOINT_BANK_SINGLE)))\r
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+       }\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
 }\r
 \r
 /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific\r
index f65c62a..7e37ac4 100644 (file)
@@ -12,7 +12,6 @@
        - Convert Host mode demos to class drivers\r
        - Convert Host mode demos to schedulerless\r
        - Add standardized descriptor names to class driver structures, controlled by USE_NONSTANDARD_DESCRIPTOR_NAMES\r
        - Convert Host mode demos to class drivers\r
        - Convert Host mode demos to schedulerless\r
        - Add standardized descriptor names to class driver structures, controlled by USE_NONSTANDARD_DESCRIPTOR_NAMES\r
-       - Device demos error if endpoint config fail\r
 ============================\r
 \r
  /** \page Page_ChangeLog Project Changelog\r
 ============================\r
 \r
  /** \page Page_ChangeLog Project Changelog\r
@@ -23,6 +22,8 @@
   *  - Added new class drivers and matching demos to the library for rapid application development\r
   *  - Added incomplete device and host mode demos for later enhancement\r
   *  - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed\r
   *  - Added new class drivers and matching demos to the library for rapid application development\r
   *  - Added incomplete device and host mode demos for later enhancement\r
   *  - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed\r
+  *  - Error status LEDs shown when device endpoint configuration fails to complete\r
+  *  - MIDI device demo no longer blocks if a note change event is sent while the endpoint is not ready\r
   *\r
   *\r
   *  \section Sec_ChangeLog090605 Version 090605\r
   *\r
   *\r
   *  \section Sec_ChangeLog090605 Version 090605\r