|
34 | 34 | #define USB_PRODUCT "Unknown"
|
35 | 35 | #endif
|
36 | 36 |
|
| 37 | +#ifndef USB_LANGUAGE |
| 38 | + #define USB_LANGUAGE 0x0409 // default is English |
| 39 | +#endif |
| 40 | + |
37 | 41 | #ifndef USB_CONFIG_POWER
|
38 | 42 | #define USB_CONFIG_POWER 100
|
39 | 43 | #endif
|
@@ -90,6 +94,7 @@ Adafruit_USBD_Device::Adafruit_USBD_Device(void)
|
90 | 94 | _itf_count = 0;
|
91 | 95 | _epin_count = _epout_count = 1;
|
92 | 96 |
|
| 97 | + _language_id = USB_LANGUAGE; |
93 | 98 | _manufacturer = USB_MANUFACTURER;
|
94 | 99 | _product = USB_PRODUCT;
|
95 | 100 | }
|
@@ -152,12 +157,18 @@ void Adafruit_USBD_Device::setVersion(uint16_t bcd)
|
152 | 157 | _desc_device.bcdUSB = bcd;
|
153 | 158 | }
|
154 | 159 |
|
155 |
| -void Adafruit_USBD_Device::setManufacturer(const char *s) |
| 160 | + |
| 161 | +void Adafruit_USBD_Device::setLanguageDescriptor (uint16_t language_id) |
| 162 | +{ |
| 163 | + _language_id = language_id; |
| 164 | +} |
| 165 | + |
| 166 | +void Adafruit_USBD_Device::setManufacturerDescriptor(const char *s) |
156 | 167 | {
|
157 | 168 | _manufacturer = s;
|
158 | 169 | }
|
159 | 170 |
|
160 |
| -void Adafruit_USBD_Device::setProduct(const char *s) |
| 171 | +void Adafruit_USBD_Device::setProductDescriptor(const char *s) |
161 | 172 | {
|
162 | 173 | _product = s;
|
163 | 174 | }
|
@@ -276,17 +287,16 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index)
|
276 | 287 | switch (index)
|
277 | 288 | {
|
278 | 289 | case 0:
|
279 |
| - // language = English |
280 |
| - _desc_str[1] = 0x0409; |
| 290 | + _desc_str[1] = USBDevice.getLanguageDescriptor(); |
281 | 291 | chr_count = 1;
|
282 | 292 | break;
|
283 | 293 |
|
284 | 294 | case 1:
|
285 |
| - chr_count = strcpy_uni16(USBDevice.getManufacturer(), _desc_str + 1, 32); |
| 295 | + chr_count = strcpy_uni16(USBDevice.getManufacturerDescriptor(), _desc_str + 1, 32); |
286 | 296 | break;
|
287 | 297 |
|
288 | 298 | case 2:
|
289 |
| - chr_count = strcpy_uni16(USBDevice.getProduct(), _desc_str + 1, 32); |
| 299 | + chr_count = strcpy_uni16(USBDevice.getProductDescriptor(), _desc_str + 1, 32); |
290 | 300 | break;
|
291 | 301 |
|
292 | 302 | case 3:
|
|
0 commit comments