Get rid of the redundant ATTR_NEVER_INLINE macro which translated to the same as...
[pub/USBasp.git] / Demos / Device / ClassDriver / KeyboardMouse / Descriptors.c
index 9920576..0d350c7 100644 (file)
@@ -87,8 +87,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
        .ProductID              = 0x204D,
        .ReleaseNumber          = VERSION_BCD(00.01),
 
-       .ManufacturerStrIndex   = 0x01,
-       .ProductStrIndex        = 0x02,
+       .ManufacturerStrIndex   = STRING_ID_Manufacturer,
+       .ProductStrIndex        = STRING_ID_Product,
        .SerialNumStrIndex      = NO_DESCRIPTOR,
 
        .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
@@ -120,7 +120,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
 
-                       .InterfaceNumber        = 0x00,
+                       .InterfaceNumber        = INTERFACE_ID_Keyboard,
                        .AlternateSetting       = 0x00,
 
                        .TotalEndpoints         = 1,
@@ -157,7 +157,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
 
-                       .InterfaceNumber        = 0x01,
+                       .InterfaceNumber        = INTERFACE_ID_Mouse,
                        .AlternateSetting       = 0x00,
 
                        .TotalEndpoints         = 1,
@@ -253,15 +253,15 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
                case DTYPE_String:
                        switch (DescriptorNumber)
                        {
-                               case 0x00:
+                               case STRING_ID_Language:
                                        Address = &LanguageString;
                                        Size    = pgm_read_byte(&LanguageString.Header.Size);
                                        break;
-                               case 0x01:
+                               case STRING_ID_Manufacturer:
                                        Address = &ManufacturerString;
                                        Size    = pgm_read_byte(&ManufacturerString.Header.Size);
                                        break;
-                               case 0x02:
+                               case STRING_ID_Product:
                                        Address = &ProductString;
                                        Size    = pgm_read_byte(&ProductString.Header.Size);
                                        break;
@@ -269,28 +269,30 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
 
                        break;
                case HID_DTYPE_HID:
-                       if (!(wIndex))
+                       switch (wIndex)
                        {
-                               Address = &ConfigurationDescriptor.HID1_KeyboardHID;
-                               Size    = sizeof(USB_HID_Descriptor_HID_t);
-                       }
-                       else
-                       {
-                               Address = &ConfigurationDescriptor.HID2_MouseHID;
-                               Size    = sizeof(USB_HID_Descriptor_HID_t);
+                               case INTERFACE_ID_Keyboard:
+                                       Address = &ConfigurationDescriptor.HID1_KeyboardHID;
+                                       Size    = sizeof(USB_HID_Descriptor_HID_t);
+                                       break;
+                               case INTERFACE_ID_Mouse:
+                                       Address = &ConfigurationDescriptor.HID2_MouseHID;
+                                       Size    = sizeof(USB_HID_Descriptor_HID_t);
+                                       break;
                        }
 
                        break;
                case HID_DTYPE_Report:
-                       if (!(wIndex))
+                       switch (wIndex)
                        {
-                               Address = &KeyboardReport;
-                               Size    = sizeof(KeyboardReport);
-                       }
-                       else
-                       {
-                               Address = &MouseReport;
-                               Size    = sizeof(MouseReport);
+                               case INTERFACE_ID_Keyboard:
+                                       Address = &KeyboardReport;
+                                       Size    = sizeof(KeyboardReport);
+                                       break;
+                               case INTERFACE_ID_Mouse:
+                                       Address = &MouseReport;
+                                       Size    = sizeof(MouseReport);
+                                       break;
                        }
 
                        break;