Minor documentation improvements.
[pub/USBasp.git] / Demos / Device / ClassDriver / KeyboardMouse / Descriptors.c
index c3b2e2c..b628a61 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2013.
+     Copyright (C) Dean Camera, 2014.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2013  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -76,7 +76,7 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
 {
        .Header                 = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
 
 {
        .Header                 = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
 
-       .USBSpecification       = VERSION_BCD(01.10),
+       .USBSpecification       = VERSION_BCD(1,1,0),
        .Class                  = USB_CSCP_NoDeviceClass,
        .SubClass               = USB_CSCP_NoDeviceSubclass,
        .Protocol               = USB_CSCP_NoDeviceProtocol,
        .Class                  = USB_CSCP_NoDeviceClass,
        .SubClass               = USB_CSCP_NoDeviceSubclass,
        .Protocol               = USB_CSCP_NoDeviceProtocol,
@@ -85,7 +85,7 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
 
        .VendorID               = 0x03EB,
        .ProductID              = 0x204D,
 
        .VendorID               = 0x03EB,
        .ProductID              = 0x204D,
-       .ReleaseNumber          = VERSION_BCD(00.01),
+       .ReleaseNumber          = VERSION_BCD(0,0,1),
 
        .ManufacturerStrIndex   = STRING_ID_Manufacturer,
        .ProductStrIndex        = STRING_ID_Product,
 
        .ManufacturerStrIndex   = STRING_ID_Manufacturer,
        .ProductStrIndex        = STRING_ID_Product,
@@ -120,7 +120,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
 
                {
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
 
-                       .InterfaceNumber        = 0x00,
+                       .InterfaceNumber        = INTERFACE_ID_Keyboard,
                        .AlternateSetting       = 0x00,
 
                        .TotalEndpoints         = 1,
                        .AlternateSetting       = 0x00,
 
                        .TotalEndpoints         = 1,
@@ -136,7 +136,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .Header                 = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
 
                {
                        .Header                 = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
 
-                       .HIDSpec                = VERSION_BCD(01.11),
+                       .HIDSpec                = VERSION_BCD(1,1,1),
                        .CountryCode            = 0x00,
                        .TotalReportDescriptors = 1,
                        .HIDReportType          = HID_DTYPE_Report,
                        .CountryCode            = 0x00,
                        .TotalReportDescriptors = 1,
                        .HIDReportType          = HID_DTYPE_Report,
@@ -157,7 +157,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
 
                {
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
 
-                       .InterfaceNumber        = 0x01,
+                       .InterfaceNumber        = INTERFACE_ID_Mouse,
                        .AlternateSetting       = 0x00,
 
                        .TotalEndpoints         = 1,
                        .AlternateSetting       = 0x00,
 
                        .TotalEndpoints         = 1,
@@ -173,7 +173,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                {
                        .Header                 = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
 
                {
                        .Header                 = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
 
-                       .HIDSpec                = VERSION_BCD(01.11),
+                       .HIDSpec                = VERSION_BCD(1,1,1),
                        .CountryCode            = 0x00,
                        .TotalReportDescriptors = 1,
                        .HIDReportType          = HID_DTYPE_Report,
                        .CountryCode            = 0x00,
                        .TotalReportDescriptors = 1,
                        .HIDReportType          = HID_DTYPE_Report,
@@ -269,28 +269,30 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
 
                        break;
                case HID_DTYPE_HID:
 
                        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:
                        }
 
                        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;
                        }
 
                        break;