1) In "usbconfig.h"
#define USB_CFG_DESCR_PROPS_HID_REPORT (USB_PROP_IS_DYNAMIC)
2) In "main.c"
PROGMEM char usbHidReportDescriptor[200] = { /* USB report descriptor, size must match usbconfig.h */
0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
0x85, 0x04, // REPORT_ID (1)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x06, // REPORT_COUNT (6)
0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0xc0 // END_COLLECTION
};
uchar usbFunctionDescriptor(struct usbRequest *rq)
{
if ((rq->bmRequestType & USBRQ_TYPE_MASK) != USBRQ_TYPE_STANDARD) return 0;
if (rq->bRequest == USBRQ_GET_DESCRIPTOR)
{
switch (rq->wValue.bytes[1])
{
case USBDESCR_HID_REPORT: usbMsgPtr = (void *)usbHidReportDescriptor; return (24);
}
}
return 0;
}
And it working great!!!
3) Now I make a non "PROGMEM" array
static char dynamical_usbHidReportDescriptor[200] = { /* USB report descriptor, size must match usbconfig.h */
0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
0x85, 0x04, // REPORT_ID (1)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x06, // REPORT_COUNT (6)
0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0xc0 // END_COLLECTION
};
uchar usbFunctionDescriptor(struct usbRequest *rq)
{
if ((rq->bmRequestType & USBRQ_TYPE_MASK) != USBRQ_TYPE_STANDARD) return 0;
if (rq->bRequest == USBRQ_GET_DESCRIPTOR)
{
switch (rq->wValue.bytes[1])
{
case USBDESCR_HID_REPORT: usbMsgPtr = (void *)dynamical_usbHidReportDescriptor; return (24);
}
}
return 0;
}
And it NOT working.
If it possible anyware? What do wrong?
PS: sorry for my very bad english.