How would I change the serial name/description to "a40h-456" ?
struct usb_string_descriptor_struct {
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t wString[10];
};
Arduino: 1.6.7 (Linux), TD: 1.27, Board: "Teensy 3.2 / 3.1, Serial, 72 MHz optimized, US English"
product:12: error: too many initializers for 'uint16_t [0] {aka short unsigned int [0]}'
};
^
product:17: error: too many initializers for 'uint16_t [0] {aka short unsigned int [0]}'
};
^
exit status 1
too many initializers for 'uint16_t [0] {aka short unsigned int [0]}'
To use these, you must create a new tab in Arduino. Use the button on the right hand side of the tabs toolbar, then select "New Tab". It will ask for you for "Name for new file". It must end in ".c". For example, "myname.c". If you use .ino, .pde or .cpp, this will not work.
In the new tab, try this:
Code:#include "usb_names.h" #define PRODUCT_NAME {'M','e','t','a','M','I','D','I'} #define PRODUCT_NAME_LEN 8 struct usb_string_descriptor_struct usb_string_product_name = { 2 + PRODUCT_NAME_LEN * 2, 3, PRODUCT_NAME };
I know this is an old question, but i ran into this issue today as well. The problem for me was, that i created a .cpp file (out of habit). The file needs to be a .c file in order to workI tried this code, and it is not working for Teensy 3.2.
If I compile with the original code, I get this error:
Code:Arduino: 1.6.7 (Linux), TD: 1.27, Board: "Teensy 3.2 / 3.1, Serial, 72 MHz optimized, US English" product:12: error: too many initializers for 'uint16_t [0] {aka short unsigned int [0]}' }; ^ product:17: error: too many initializers for 'uint16_t [0] {aka short unsigned int [0]}' }; ^ exit status 1 too many initializers for 'uint16_t [0] {aka short unsigned int [0]}'