diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.c b/Demos/Device/LowLevel/AudioInput/AudioInput.c index 7757ef10c648a631630c1f9e11240c7a22254e4c..50e7f4df4548eb19a27d705d548d00345ca890e1 100644 --- a/Demos/Device/LowLevel/AudioInput/AudioInput.c +++ b/Demos/Device/LowLevel/AudioInput/AudioInput.c @@ -109,13 +109,16 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup audio stream endpoint */ - Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS, - ENDPOINT_DIR_IN, AUDIO_STREAM_EPSIZE, - ENDPOINT_BANK_DOUBLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup audio stream endpoint */ + if (!(Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS, + ENDPOINT_DIR_IN, AUDIO_STREAM_EPSIZE, + ENDPOINT_BANK_DOUBLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c index 7a9c6eca044de20ec78501ac90b2c847e410e090..07418d5d90c0832f154de53a13d4dae7665420f7 100644 --- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c +++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c @@ -136,13 +136,16 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup audio stream endpoint */ - Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS, - ENDPOINT_DIR_OUT, AUDIO_STREAM_EPSIZE, - ENDPOINT_BANK_DOUBLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup audio stream endpoint */ + if (!(Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS, + ENDPOINT_DIR_OUT, AUDIO_STREAM_EPSIZE, + ENDPOINT_BANK_DOUBLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/CDC/CDC.c b/Demos/Device/LowLevel/CDC/CDC.c index 3db4c1e55c7a4cc2aef996bcde2c115f9a985d02..99343894e6e25dabba96f91602dea15d3f099d03 100644 --- a/Demos/Device/LowLevel/CDC/CDC.c +++ b/Demos/Device/LowLevel/CDC/CDC.c @@ -105,21 +105,30 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup CDC Notification, Rx and Tx Endpoints */ - Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup CDC Notification, Rx and Tx Endpoints */ + if (!(Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/DualCDC/DualCDC.c b/Demos/Device/LowLevel/DualCDC/DualCDC.c index 839d6d98ed421bf3f66804501f2227de35153bbb..1031068ad07cc101c8bebcfafcbbbff9b206c54b 100644 --- a/Demos/Device/LowLevel/DualCDC/DualCDC.c +++ b/Demos/Device/LowLevel/DualCDC/DualCDC.c @@ -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. */ void EVENT_USB_ConfigurationChanged(void) -{ - /* Setup CDC Notification, Rx and Tx Endpoints for the first CDC */ - Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC1_TX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC1_RX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - - /* Setup CDC Notification, Rx and Tx Endpoints for the second CDC */ - Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC2_TX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC2_RX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - +{ /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup CDC Notification, Rx and Tx Endpoints for the first CDC */ + if (!(Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC1_TX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC1_RX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + /* Setup CDC Notification, Rx and Tx Endpoints for the second CDC */ + if (!(Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC2_TX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC2_RX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.c b/Demos/Device/LowLevel/GenericHID/GenericHID.c index a604bbe8d35e73a3c605c77783981cb1f4cd76d6..40de8b94ae7dbf9a543a6eeac9560a452503a9c5 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.c +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.c @@ -94,18 +94,24 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup Generic IN Report Endpoint */ - Endpoint_ConfigureEndpoint(GENERIC_IN_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, GENERIC_EPSIZE, - ENDPOINT_BANK_SINGLE); - - /* Setup Generic OUT Report Endpoint */ - Endpoint_ConfigureEndpoint(GENERIC_OUT_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_OUT, GENERIC_EPSIZE, - ENDPOINT_BANK_SINGLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup Generic IN Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(GENERIC_IN_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, GENERIC_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + /* Setup Generic OUT Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(GENERIC_OUT_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_OUT, GENERIC_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/Joystick/Joystick.c b/Demos/Device/LowLevel/Joystick/Joystick.c index 94763b82aee0f80b8ee8bcc048d3a4c51b5a7e78..0c018aa8d64a16a7dd6b1826d94f31438089f454 100644 --- a/Demos/Device/LowLevel/Joystick/Joystick.c +++ b/Demos/Device/LowLevel/Joystick/Joystick.c @@ -92,13 +92,16 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup Joystick Report Endpoint */ - Endpoint_ConfigureEndpoint(JOYSTICK_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, JOYSTICK_EPSIZE, - ENDPOINT_BANK_SINGLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup Joystick Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(JOYSTICK_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, JOYSTICK_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.c b/Demos/Device/LowLevel/Keyboard/Keyboard.c index 06806b58b9a121da62500c3ed79fd7417e873843..35ef41ba8a1b13d7499a914ecc7a73b609334b01 100644 --- a/Demos/Device/LowLevel/Keyboard/Keyboard.c +++ b/Demos/Device/LowLevel/Keyboard/Keyboard.c @@ -118,19 +118,25 @@ void EVENT_USB_Disconnect(void) * of the USB device after enumeration, and configures the keyboard device endpoints. */ void EVENT_USB_ConfigurationChanged(void) -{ - /* Setup Keyboard Keycode Report Endpoint */ - Endpoint_ConfigureEndpoint(KEYBOARD_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, KEYBOARD_EPSIZE, - ENDPOINT_BANK_SINGLE); - - /* Setup Keyboard LED Report Endpoint */ - Endpoint_ConfigureEndpoint(KEYBOARD_LEDS_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_OUT, KEYBOARD_EPSIZE, - ENDPOINT_BANK_SINGLE); - +{ /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup Keyboard Keycode Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(KEYBOARD_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, KEYBOARD_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + /* Setup Keyboard LED Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(KEYBOARD_LEDS_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_OUT, KEYBOARD_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c index 9127fea9ed9bf79b8be0de281a9494ca4c4e61ef..ddfe05a4b4db64ae8c0c309ec5e8a611d034073f 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c @@ -100,23 +100,32 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup Keyboard Report Endpoint */ - Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, HID_EPSIZE, - ENDPOINT_BANK_SINGLE); + /* Indicate USB connected and ready */ + LEDs_SetAllLEDs(LEDMASK_USB_READY); + /* Setup Keyboard Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, HID_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + /* Setup Keyboard LED Report Endpoint */ - Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_OUT, HID_EPSIZE, - ENDPOINT_BANK_SINGLE); + if (!(Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_OUT, HID_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } /* Setup Mouse Report Endpoint */ - Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, HID_EPSIZE, - ENDPOINT_BANK_SINGLE); - - /* Indicate USB connected and ready */ - LEDs_SetAllLEDs(LEDMASK_USB_READY); + if (!(Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, HID_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/MIDI/MIDI.c b/Demos/Device/LowLevel/MIDI/MIDI.c index 6dd38af85a5626586f5016e7f055a95fb449ab61..856f7dbe9488210f41158ffee491dae2a13235e9 100644 --- a/Demos/Device/LowLevel/MIDI/MIDI.c +++ b/Demos/Device/LowLevel/MIDI/MIDI.c @@ -90,17 +90,23 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup MIDI stream endpoints */ - Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE, - ENDPOINT_BANK_SINGLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup MIDI stream endpoints */ + if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Task to handle the generation of MIDI note change events in response to presses of the board joystick, and send them @@ -159,8 +165,9 @@ void MIDI_Task(void) */ void SendMIDINoteChange(const uint8_t Pitch, const bool OnOff, const uint8_t CableID, const uint8_t Channel) { - /* Wait until endpoint ready for more data */ - while (!(Endpoint_IsReadWriteAllowed())); + /* If endpoint ready for more data, abort */ + if (!(Endpoint_IsReadWriteAllowed())) + return; /* Check if the message should be a Note On or Note Off command */ uint8_t Command = ((OnOff)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF); diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.c b/Demos/Device/LowLevel/MassStorage/MassStorage.c index 62c7f21da7831c70dc7fa225f6fe51fcdd958255..ee2a9d7928db5c8b27988666f02e67a7ade86016 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.c +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.c @@ -106,17 +106,23 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { + /* Indicate USB connected and ready */ + LEDs_SetAllLEDs(LEDMASK_USB_READY); + /* Setup Mass Storage In and Out Endpoints */ - Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK, + if (!(Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN, MASS_STORAGE_IO_EPSIZE, - ENDPOINT_BANK_DOUBLE); - - Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPNUM, EP_TYPE_BULK, + ENDPOINT_BANK_DOUBLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT, MASS_STORAGE_IO_EPSIZE, - ENDPOINT_BANK_DOUBLE); - - /* Indicate USB connected and ready */ - LEDs_SetAllLEDs(LEDMASK_USB_READY); + ENDPOINT_BANK_DOUBLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/Mouse/Mouse.c b/Demos/Device/LowLevel/Mouse/Mouse.c index 422153672ed988b798c579085232d681211491f6..c586b5971d260f79bc0d0b28b7fdf6f9bb76ecb6 100644 --- a/Demos/Device/LowLevel/Mouse/Mouse.c +++ b/Demos/Device/LowLevel/Mouse/Mouse.c @@ -119,13 +119,16 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup Mouse Report Endpoint */ - Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, MOUSE_EPSIZE, - ENDPOINT_BANK_SINGLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup Mouse Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, MOUSE_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c index e651a1b1289a9d3b0f1cee99c9d2b12028089c93..84fc5b4c9d858d317d6ba50212804aa456859e10 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c @@ -99,21 +99,30 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup CDC Notification, Rx and Tx Endpoints */ - Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); + /* Indicate USB connected and ready */ + LEDs_SetAllLEDs(LEDMASK_USB_READY); - Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); + /* Setup CDC Notification, Rx and Tx Endpoints */ + if (!(Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } - Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, - ENDPOINT_BANK_SINGLE); + if (!(Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } - /* Indicate USB connected and ready */ - LEDs_SetAllLEDs(LEDMASK_USB_READY); + if (!(Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c index ee4208f19f4a7a157f2636db90fa4cc4012e221f..3ed406db4fd4c94a2c468a7b8915e0784c959890 100644 --- a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c +++ b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c @@ -113,21 +113,30 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup CDC Notification, Rx and Tx Endpoints */ - Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup CDC Notification, Rx and Tx Endpoints */ + if (!(Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/LUFA/ChangeLog.txt b/LUFA/ChangeLog.txt index f65c62aeeddae136fa713acb52681126736eb6dc..7e37ac45bffb1de689392beb61a45565501b0715 100644 --- a/LUFA/ChangeLog.txt +++ b/LUFA/ChangeLog.txt @@ -12,7 +12,6 @@ - Convert Host mode demos to class drivers - Convert Host mode demos to schedulerless - Add standardized descriptor names to class driver structures, controlled by USE_NONSTANDARD_DESCRIPTOR_NAMES - - Device demos error if endpoint config fail ============================ /** \page Page_ChangeLog Project Changelog @@ -23,6 +22,8 @@ * - Added new class drivers and matching demos to the library for rapid application development * - Added incomplete device and host mode demos for later enhancement * - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed + * - Error status LEDs shown when device endpoint configuration fails to complete + * - MIDI device demo no longer blocks if a note change event is sent while the endpoint is not ready * * * \section Sec_ChangeLog090605 Version 090605