X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/eed7d4df6ae3da8616ec294d303ceea26078c707..27f0ba6fc30db478fbab0b952bf2c3137f5a7719:/Bootloaders/TeensyHID/Descriptors.c diff --git a/Bootloaders/TeensyHID/Descriptors.c b/Bootloaders/TeensyHID/Descriptors.c index 2832ec393..4142f1247 100644 --- a/Bootloaders/TeensyHID/Descriptors.c +++ b/Bootloaders/TeensyHID/Descriptors.c @@ -157,26 +157,29 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void* Address = NULL; uint16_t Size = NO_DESCRIPTOR; - switch (DescriptorType) + /* If/Else If chain compiles slightly smaller than a switch case */ + + if (DescriptorType == DTYPE_Device) + { + Address = (void*)&DeviceDescriptor; + Size = sizeof(USB_Descriptor_Device_t); + } + else if (DescriptorType == DTYPE_Device) + { + Address = (void*)&ConfigurationDescriptor; + Size = sizeof(USB_Descriptor_Configuration_t); + } + else if (DescriptorType == DTYPE_HID) + { + Address = (void*)&ConfigurationDescriptor.HID_VendorHID; + Size = sizeof(USB_Descriptor_HID_t); + } + else { - case DTYPE_Device: - Address = (void*)&DeviceDescriptor; - Size = sizeof(USB_Descriptor_Device_t); - break; - case DTYPE_Configuration: - Address = (void*)&ConfigurationDescriptor; - Size = sizeof(USB_Descriptor_Configuration_t); - break; - case DTYPE_HID: - Address = (void*)&ConfigurationDescriptor.HID_VendorHID; - Size = sizeof(USB_Descriptor_HID_t); - break; - case DTYPE_Report: - Address = (void*)&HIDReport; - Size = sizeof(HIDReport); - break; + Address = (void*)&HIDReport; + Size = sizeof(HIDReport); } - + *DescriptorAddress = Address; return Size; }