Removed software PDI/TPI emulation from the AVRISP-MKII clone project, as it was...
[pub/USBasp.git] / Bootloaders / TeensyHID / Descriptors.c
index ae5efd0..4142f12 100644 (file)
@@ -1,13 +1,13 @@
 /*\r
              LUFA Library\r
-     Copyright (C) Dean Camera, 2009.\r
+     Copyright (C) Dean Camera, 2010.\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
-  Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
          \r
   Permission to use, copy, modify, distribute, and sell this \r
   software and its documentation for any purpose is hereby granted\r
@@ -106,7 +106,7 @@ USB_Descriptor_Configuration_t ConfigurationDescriptor =
                        .MaxPowerConsumption    = USB_CONFIG_POWER_MA(100)\r
                },\r
                \r
-       .Interface = \r
+       .HID_Interface = \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},\r
 \r
@@ -122,7 +122,7 @@ USB_Descriptor_Configuration_t ConfigurationDescriptor =
                        .InterfaceStrIndex      = NO_DESCRIPTOR\r
                },\r
 \r
-       .HIDDescriptor = \r
+       .HID_VendorHID = \r
                {  \r
                        .Header                 = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},\r
                        \r
@@ -133,7 +133,7 @@ USB_Descriptor_Configuration_t ConfigurationDescriptor =
                        .HIDReportLength        = sizeof(HIDReport)\r
                },\r
                \r
-       .HIDEndpoint = \r
+       .HID_ReportINEndpoint = \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
 \r
@@ -157,26 +157,29 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex,
        void*    Address = NULL;\r
        uint16_t Size    = NO_DESCRIPTOR;\r
 \r
-       switch (DescriptorType)\r
+       /* If/Else If chain compiles slightly smaller than a switch case */\r
+\r
+       if (DescriptorType == DTYPE_Device)\r
+       {\r
+               Address = (void*)&DeviceDescriptor;\r
+               Size    = sizeof(USB_Descriptor_Device_t);      \r
+       }\r
+       else if (DescriptorType == DTYPE_Device)\r
+       {\r
+               Address = (void*)&ConfigurationDescriptor;\r
+               Size    = sizeof(USB_Descriptor_Configuration_t);       \r
+       }\r
+       else if (DescriptorType == DTYPE_HID)\r
+       {\r
+               Address = (void*)&ConfigurationDescriptor.HID_VendorHID;\r
+               Size    = sizeof(USB_Descriptor_HID_t);\r
+       }\r
+       else\r
        {\r
-               case DTYPE_Device:\r
-                       Address = (void*)&DeviceDescriptor;\r
-                       Size    = sizeof(USB_Descriptor_Device_t);\r
-                       break;\r
-               case DTYPE_Configuration:\r
-                       Address = (void*)&ConfigurationDescriptor;\r
-                       Size    = sizeof(USB_Descriptor_Configuration_t);\r
-                       break;\r
-               case DTYPE_HID:\r
-                       Address = (void*)&ConfigurationDescriptor.HIDDescriptor;\r
-                       Size    = sizeof(USB_Descriptor_HID_t);\r
-                       break;\r
-               case DTYPE_Report:\r
-                       Address = (void*)&HIDReport;\r
-                       Size    = sizeof(HIDReport);\r
-                       break;\r
+               Address = (void*)&HIDReport;\r
+               Size    = sizeof(HIDReport);\r
        }\r
-       \r
+\r
        *DescriptorAddress = Address;\r
        return Size;\r
 }\r