Minor documentation enhancements.
[pub/USBasp.git] / Demos / Device / Incomplete / TestAndMeasurement / Descriptors.c
index 08419a9..aac1690 100644 (file)
@@ -59,7 +59,7 @@ 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(02.00),
+       .USBSpecification       = VERSION_BCD(01.10),
        .Class                  = 0x00,
        .SubClass               = 0x00,
        .Protocol               = 0x00,
        .Class                  = 0x00,
        .SubClass               = 0x00,
        .Protocol               = 0x00,
@@ -68,7 +68,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
 
        .VendorID               = 0x03EB,
        .ProductID              = 0x2065,
 
        .VendorID               = 0x03EB,
        .ProductID              = 0x2065,
-       .ReleaseNumber          = 0x0000,
+       .ReleaseNumber          = VERSION_BCD(00.01),
 
        .ManufacturerStrIndex   = 0x01,
        .ProductStrIndex        = 0x02,
 
        .ManufacturerStrIndex   = 0x01,
        .ProductStrIndex        = 0x02,
@@ -106,7 +106,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .InterfaceNumber        = 0x00,
                        .AlternateSetting       = 0x00,
                        
                        .InterfaceNumber        = 0x00,
                        .AlternateSetting       = 0x00,
                        
-                       .TotalEndpoints         = 2,
+                       .TotalEndpoints         = 3,
                                
                        .Class                  = 0xFE,
                        .SubClass               = 0x03,
                                
                        .Class                  = 0xFE,
                        .SubClass               = 0x03,
@@ -133,6 +133,16 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .Attributes             = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
                        .EndpointSize           = TMC_IO_EPSIZE,
                        .PollingIntervalMS      = 0x00
                        .Attributes             = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
                        .EndpointSize           = TMC_IO_EPSIZE,
                        .PollingIntervalMS      = 0x00
+               },
+               
+       .NotificationEndpoint = 
+               {
+                       .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
+                       
+                       .EndpointAddress        = (ENDPOINT_DESCRIPTOR_DIR_IN | TMC_NOTIFICATION_EPNUM),
+                       .Attributes             = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
+                       .EndpointSize           = TMC_NOTIFICATION_EPSIZE,
+                       .PollingIntervalMS      = 0xFF
                }
 };
 
                }
 };
 
@@ -177,37 +187,37 @@ USB_Descriptor_String_t PROGMEM ProductString =
  */
 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
                                     const uint8_t wIndex,
  */
 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
                                     const uint8_t wIndex,
-                                    void** const DescriptorAddress)
+                                    const void** const DescriptorAddress)
 {
        const uint8_t  DescriptorType   = (wValue >> 8);
        const uint8_t  DescriptorNumber = (wValue & 0xFF);
 
 {
        const uint8_t  DescriptorType   = (wValue >> 8);
        const uint8_t  DescriptorNumber = (wValue & 0xFF);
 
-       void*          Address = NULL;
-       uint16_t       Size    = NO_DESCRIPTOR;
+       const void* Address = NULL;
+       uint16_t    Size    = NO_DESCRIPTOR;
 
        switch (DescriptorType)
        {
                case DTYPE_Device:
 
        switch (DescriptorType)
        {
                case DTYPE_Device:
-                       Address = (void*)&DeviceDescriptor;
+                       Address = &DeviceDescriptor;
                        Size    = sizeof(USB_Descriptor_Device_t);
                        break;
                case DTYPE_Configuration: 
                        Size    = sizeof(USB_Descriptor_Device_t);
                        break;
                case DTYPE_Configuration: 
-                       Address = (void*)&ConfigurationDescriptor;
+                       Address = &ConfigurationDescriptor;
                        Size    = sizeof(USB_Descriptor_Configuration_t);
                        break;
                case DTYPE_String: 
                        switch (DescriptorNumber)
                        {
                                case 0x00: 
                        Size    = sizeof(USB_Descriptor_Configuration_t);
                        break;
                case DTYPE_String: 
                        switch (DescriptorNumber)
                        {
                                case 0x00: 
-                                       Address = (void*)&LanguageString;
+                                       Address = &LanguageString;
                                        Size    = pgm_read_byte(&LanguageString.Header.Size);
                                        break;
                                case 0x01: 
                                        Size    = pgm_read_byte(&LanguageString.Header.Size);
                                        break;
                                case 0x01: 
-                                       Address = (void*)&ManufacturerString;
+                                       Address = &ManufacturerString;
                                        Size    = pgm_read_byte(&ManufacturerString.Header.Size);
                                        break;
                                case 0x02: 
                                        Size    = pgm_read_byte(&ManufacturerString.Header.Size);
                                        break;
                                case 0x02: 
-                                       Address = (void*)&ProductString;
+                                       Address = &ProductString;
                                        Size    = pgm_read_byte(&ProductString.Header.Size);
                                        break;
                        }
                                        Size    = pgm_read_byte(&ProductString.Header.Size);
                                        break;
                        }