2
2
3
3
#ifdef SERIAL_CDC
4
4
USBSerial arduino::internal::_serial (false , BOARD_VENDORID, BOARD_PRODUCTID);
5
+
6
+ const uint8_t *USBCDC::device_desc ()
7
+ {
8
+ uint8_t ep0_size = endpoint_max_packet_size (0x00 );
9
+ uint8_t device_descriptor_temp[] = {
10
+ 18 , // bLength
11
+ 1 , // bDescriptorType
12
+ 0x00 , 0x02 , // bcdUSB
13
+ 2 , // bDeviceClass
14
+ 0 , // bDeviceSubClass
15
+ 0 , // bDeviceProtocol
16
+ ep0_size, // bMaxPacketSize0
17
+ (uint8_t )(LSB (vendor_id)), (uint8_t )(MSB (vendor_id)), // idVendor
18
+ (uint8_t )(LSB (product_id)), (uint8_t )(MSB (product_id)),// idProduct
19
+ 0x00 , 0x01 , // bcdDevice
20
+ 1 , // iManufacturer
21
+ 2 , // iProduct
22
+ 3 , // iSerialNumber
23
+ 1 // bNumConfigurations
24
+ };
25
+ MBED_ASSERT (sizeof (device_descriptor_temp) == sizeof (device_descriptor));
26
+ memcpy (device_descriptor, device_descriptor_temp, sizeof (device_descriptor));
27
+ return device_descriptor;
28
+ }
29
+
30
+ const uint8_t *USBCDC::string_iinterface_desc ()
31
+ {
32
+ static const uint8_t stringIinterfaceDescriptor[] = {
33
+ 0x08 ,
34
+ STRING_DESCRIPTOR,
35
+ ' C' , 0 , ' D' , 0 , ' C' , 0 ,
36
+ };
37
+ return stringIinterfaceDescriptor;
38
+ }
39
+
40
+ const uint8_t *USBCDC::string_iproduct_desc ()
41
+ {
42
+ static const uint8_t stringIproductDescriptor[] = {
43
+ 0x18 ,
44
+ STRING_DESCRIPTOR,
45
+ ' N' , 0 , ' A' , 0 , ' N' , 0 , ' O' , 0 , ' ' , 0 , ' 3' , 0 , ' 3' , 0 , ' ' , 0 , ' B' , 0 , ' L' , 0 , ' E' , 0
46
+ };
47
+ return stringIproductDescriptor;
48
+ }
49
+
50
+ const uint8_t *USBDevice::string_imanufacturer_desc ()
51
+ {
52
+ static const uint8_t string_imanufacturer_descriptor[] = {
53
+ 0x10 , /* bLength*/
54
+ STRING_DESCRIPTOR, /* bDescriptorType 0x03*/
55
+ ' A' , 0 , ' r' , 0 , ' d' , 0 , ' u' , 0 , ' i' , 0 , ' n' , 0 , ' o' , 0 , /* bString iManufacturer - Arduino*/
56
+ };
57
+ return string_imanufacturer_descriptor;
58
+ }
59
+
60
+ #ifdef HAS_UNIQUE_ISERIAL_DESCRIPTOR
61
+
62
+ static uint8_t _internal_string_iserial_descriptor[34 ] = {
63
+ 0x2 , /* bLength*/
64
+ STRING_DESCRIPTOR, /* bDescriptorType 0x03*/
65
+ /* bString iSerial - memcpy at runtime*/
66
+ };
67
+ uint8_t *USBDevice::string_iserial_desc ()
68
+ {
69
+ _internal_string_iserial_descriptor[0 ] += getUniqueSerialNumber (&_internal_string_iserial_descriptor[2 ]);
70
+
71
+ return _internal_string_iserial_descriptor;
72
+ }
73
+ #endif
74
+
5
75
#endif
0 commit comments