Removed complicated logic for the Endpoint_ConfigureEndpoint() function to use inlined or function called versions depending of if the given bank size is a compile time constant, as the compiler does a better job of optimizing with basic code.
Changed over all device demos to use a clearer algorithm for the configuring of the application's endpoints.
This commit is contained in:
parent
be520aed52
commit
508e905d8d
43 changed files with 374 additions and 510 deletions
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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;
|
||||
|
||||
if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface)))
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
ConfigSuccess &= MS_Device_ConfigureEndpoints(&Disk_MS_Interface);
|
||||
|
||||
USB_Device_EnableSOFEvents();
|
||||
|
||||
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
|
||||
}
|
||||
|
||||
/** Event handler for the library USB Unhandled Control Request event. */
|
||||
|
|
|
@ -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);
|
||||
bool ConfigSuccess = true;
|
||||
|
||||
if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface)))
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
|
||||
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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue