diff options
Diffstat (limited to 'Demos/Device/ClassDriver')
14 files changed, 66 insertions, 56 deletions
diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c index 32caffcce..ceaeb89a1 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -136,10 +136,11 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); - - if (!(Audio_Device_ConfigureEndpoints(&Microphone_Audio_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + bool ConfigSuccess = true; + + ConfigSuccess &= Audio_Device_ConfigureEndpoints(&Microphone_Audio_Interface); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c index 8587093cd..cf2eb2d30 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c @@ -188,10 +188,11 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); - - if (!(Audio_Device_ConfigureEndpoints(&Speaker_Audio_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + bool ConfigSuccess = true; + + ConfigSuccess &= Audio_Device_ConfigureEndpoints(&Speaker_Audio_Interface); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c index ffbc12c7f..915c8fc98 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c +++ b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c @@ -175,13 +175,12 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); + bool ConfigSuccess = true; - if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial1_CDC_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial1_CDC_Interface); + ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial2_CDC_Interface); - if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial2_CDC_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c index 8b51b7657..4fe58a8a2 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c @@ -113,12 +113,13 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); + bool ConfigSuccess = true; - if (!(HID_Device_ConfigureEndpoints(&Generic_HID_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + ConfigSuccess &= HID_Device_ConfigureEndpoints(&Generic_HID_Interface); USB_Device_EnableSOFEvents(); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.c b/Demos/Device/ClassDriver/Joystick/Joystick.c index e2804d6e0..622106fd4 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.c +++ b/Demos/Device/ClassDriver/Joystick/Joystick.c @@ -107,12 +107,13 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); + bool ConfigSuccess = true; - if (!(HID_Device_ConfigureEndpoints(&Joystick_HID_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + ConfigSuccess &= HID_Device_ConfigureEndpoints(&Joystick_HID_Interface); USB_Device_EnableSOFEvents(); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c index 80f0ad988..8d8503031 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c @@ -107,12 +107,13 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); + bool ConfigSuccess = true; - if (!(HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + ConfigSuccess &= HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface); USB_Device_EnableSOFEvents(); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c index 43634eac3..6ba7ce3d0 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c @@ -130,15 +130,14 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); + bool ConfigSuccess = true; - if (!(HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - - if (!(HID_Device_ConfigureEndpoints(&Mouse_HID_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + ConfigSuccess &= HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface); + ConfigSuccess &= HID_Device_ConfigureEndpoints(&Mouse_HID_Interface); USB_Device_EnableSOFEvents(); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/MIDI/MIDI.c b/Demos/Device/ClassDriver/MIDI/MIDI.c index 04d4bdb21..f627d55be 100644 --- a/Demos/Device/ClassDriver/MIDI/MIDI.c +++ b/Demos/Device/ClassDriver/MIDI/MIDI.c @@ -180,10 +180,13 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); - - if (!(MIDI_Device_ConfigureEndpoints(&Keyboard_MIDI_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + bool ConfigSuccess = true; + + ConfigSuccess &= MIDI_Device_ConfigureEndpoints(&Keyboard_MIDI_Interface); + + USB_Device_EnableSOFEvents(); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c index b1ec7d375..a8f21f173 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.c +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.c @@ -110,10 +110,13 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); + bool ConfigSuccess = true; + + ConfigSuccess &= MS_Device_ConfigureEndpoints(&Disk_MS_Interface); + + USB_Device_EnableSOFEvents(); - if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c index 4ac5ebde3..ba6213076 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c @@ -136,15 +136,14 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); - - if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + bool ConfigSuccess = true; - if (!(HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + ConfigSuccess &= MS_Device_ConfigureEndpoints(&Disk_MS_Interface); + ConfigSuccess &= HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface); USB_Device_EnableSOFEvents(); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.c b/Demos/Device/ClassDriver/Mouse/Mouse.c index 19ca0132a..6efdb9973 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.c +++ b/Demos/Device/ClassDriver/Mouse/Mouse.c @@ -107,12 +107,13 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); + bool ConfigSuccess = true; - if (!(HID_Device_ConfigureEndpoints(&Mouse_HID_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + ConfigSuccess &= HID_Device_ConfigureEndpoints(&Mouse_HID_Interface); USB_Device_EnableSOFEvents(); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c index 76c49068e..d332b206a 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c @@ -123,10 +123,11 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); + bool ConfigSuccess = true; - if (!(RNDIS_Device_ConfigureEndpoints(&Ethernet_RNDIS_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + ConfigSuccess &= RNDIS_Device_ConfigureEndpoints(&Ethernet_RNDIS_Interface); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c index c87b33ca7..1ee0b344c 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c +++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c @@ -153,10 +153,11 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); + bool ConfigSuccess = true; - if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c index 6dfdafba7..86cdb4e7a 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c @@ -164,15 +164,14 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - LEDs_SetAllLEDs(LEDMASK_USB_READY); + bool ConfigSuccess = true; - if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface); + ConfigSuccess &= HID_Device_ConfigureEndpoints(&Mouse_HID_Interface); - if (!(HID_Device_ConfigureEndpoints(&Mouse_HID_Interface))) - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - USB_Device_EnableSOFEvents(); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); } /** Event handler for the library USB Unhandled Control Request event. */ |