|
![]() USB
![]() "too many initializers" compile error when using report ID in HID descriptor
|
| next newest topic | next oldest topic |
| Author | Topic: "too many initializers" compile error when using report ID in HID descriptor |
|
tosa New Member |
Hi, 1) The following code gives "too many initializers" error. If I comment out the report IDs and change the descriptor length to 0x22 then is compiles okay. The descriptor length should be 0x26 when including the report IDs. 2)If report ID not used, I can still compile the code with any value for the descriptor length (although only using the correct length gives proper transactions over USB). Why don't I get a compile error? Thanks!
// From "USB Device Class Definition for Human Interface Devices (HID)". { // configuration_descriptor hid_configuration_descriptor { // interface_descriptor hid_interface_descriptor { // class_descriptor hid_descriptor // IN endpoint (mandatory for HID) // OUT endpoint (optional for HID) }; code const hid_report_descriptor HIDREPORTDESC = 0x85, 1, 0x85, 1, 0xC0 // end Application Collection IP: Logged |
|
classics Member |
What toolchain? In Keil those should be marked 'const code' or they will be in RAM and code will be generated to fill the ram during the startup.a51 code. IP: Logged |
|
tosa New Member |
I'm using the compiler defaults in Keil C51 (but variable location small or large gives same results). Isn't my code marked 'code const', or is there someplace else that this needs to be done? 'const code' doesn't compile. [This message has been edited by tosa (edited July 28, 2010).] IP: Logged |
|
Tsuneo Member |
What is "hid_report_descriptor" definition? Doesn't the definition have array size? Tsuneo IP: Logged |
|
tosa New Member |
Isn't the bold number the byte length of the HID report descriptor? So that should be 0x2200 or 0x2600, depending on whether or I use the report ID bytes or not? { // class_descriptor hid_descriptor [This message has been edited by tosa (edited July 29, 2010).] IP: Logged |
|
tosa New Member |
Found the problem...the array size was also being defined by the HID_REPORT_DESCRIPTOR_SIZE definition, which I didn't change. Thanks for your help! IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() |
|
Have you seen our MCU Knowledge Base?