@ -159,17 +159,27 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const void * Address = NULL ;
const void * Address = NULL ;
uint16_t Size = NO_DESCRIPTOR ;
uint16_t Size = NO_DESCRIPTOR ;
/* If/Else If chain compiles slightly smaller than a switch case */
if ( DescriptorType = = DTYPE_Device )
if ( DescriptorType = = DTYPE_Device )
{
Address = & DeviceDescriptor ;
Address = & DeviceDescriptor ;
Size = sizeof ( USB_Descriptor_Device_t ) ;
}
else if ( DescriptorType = = DTYPE_Configuration )
else if ( DescriptorType = = DTYPE_Configuration )
{
Address = & ConfigurationDescriptor ;
Address = & ConfigurationDescriptor ;
Size = sizeof ( USB_Descriptor_Configuration_t ) ;
}
else if ( DescriptorType = = HID_DTYPE_HID )
else if ( DescriptorType = = HID_DTYPE_HID )
{
Address = & ConfigurationDescriptor . HID_VendorHID ;
Address = & ConfigurationDescriptor . HID_VendorHID ;
Size = sizeof ( USB_HID_Descriptor_HID_t ) ;
}
else
else
{
Address = & HIDReport ;
Address = & HIDReport ;
Size = sizeof ( HIDReport ) ;
if ( Address ! = NULL )
}
Size = ( Address = = & HIDReport ) ? sizeof ( HIDReport ) : ( ( USB_Descriptor_Header_t * ) Address ) - > Size ;
* DescriptorAddress = Address ;
* DescriptorAddress = Address ;
return Size ;
return Size ;