const U8 HID_ReportDescriptor[] = {
#if 1
#if 1
0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x85, 0x01, // REPORT_ID (1)
0x95, 0x0f, // REPORT_COUNT (7)
0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0x85, 0x02, // REPORT_ID (2)
0x95, 0x3f, // REPORT_COUNT (63)
0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0x85, 0x03, // REPORT_ID (3)
0x95, 0x7f, // REPORT_COUNT (31)
0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0x85, 0x04, // REPORT_ID (4)
0x95, 0x1f, // REPORT_COUNT (15)
0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0xc0 // END_COLLECTION
#else
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x00, // USAGE (0)
0xA1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0xFF, // LOGICAL_MAXIMUM (255)
0x19, 0x01, // USAGE_MINIMUM (1)
0x29, 0x08, // USAGE_MAXIMUM (8)
0x95, USB_MAX_PACKET0, // REPORT_COUNT (8)
0x75, 0x08, // REPORT_SIZE (8)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x19, 0x01, // USAGE_MINIMUM (1)
0x29, 0x08, // USAGE_MAXIMUM (8)
0x91, 0x02, // OUTPUT (Data,Var,Abs)
0xC0 // END_COLLECTION
#endif
#else
HID_UsagePageVendor( 0x00 ),
HID_Usage ( 0x01 ),
HID_Collection ( HID_Application ),
HID_LogicalMin ( 0 ), /* value range: 0 - 0xFF */
HID_LogicalMaxS ( 0xFF ),
HID_ReportSize ( 8 ), /* 8 bits */
HID_ReportCount ( HID_INPUT_REPORT_BYTES ),
HID_Usage ( 0x01 ),
HID_Input ( HID_Data | HID_Variable | HID_Absolute ),
HID_ReportCount ( HID_OUTPUT_REPORT_BYTES ),
HID_Usage ( 0x01 ),
HID_Output ( HID_Data | HID_Variable | HID_Absolute ),
HID_ReportCount ( HID_FEATURE_REPORT_BYTES ),
HID_Usage ( 0x01 ),
HID_Feature ( HID_Data | HID_Variable | HID_Absolute ),
HID_EndCollection,
#endif
};
void Hid_GetFeature(void)
{
int i=0;
if(ReportID == 1)
{
WordsCpy(EP0Buf, (void*)GetHidBuffer, 8);
}
else if(ReportID==3)
{
#if 1
for(i=0;i<128;i++)
{
if(run.fun == USBPRG_FALSH)
{
EP0Buf[i] = pw.fpRead(wrt.address);
}
else if(run.fun == USBPRG_EEPROM)
{
EP0Buf[i] = pw.fpReadE(wrt.address);
}
wrt.address++;
}
#endif
// WordsCpy(EP0Buf, (void*)GetHidBuffer, 128);
}else if(ReportID==2)
{
for(i=0;i<64;i++)
{
if(run.fun == USBPRG_FALSH)
{
EP0Buf[i] = pw.fpRead(wrt.address);
}
else if(run.fun == USBPRG_EEPROM)
{
EP0Buf[i] = pw.fpReadE(wrt.address);
}
wrt.address++;
}
}
} |