@@ -58,10 +58,8 @@ static volatile LineInfo _usbLineInfo = {
58
58
0x00 // lineState
59
59
};
60
60
61
- static const CDCDescriptor _cdcInterface = {
62
- #if (defined CDC_ENABLED) && defined(HID_ENABLED)
61
+ static CDCDescriptor _cdcInterface = {
63
62
D_IAD (0 , 2 , CDC_COMMUNICATION_INTERFACE_CLASS, CDC_ABSTRACT_CONTROL_MODEL, 0 ),
64
- #endif
65
63
66
64
// CDC communication interface
67
65
D_INTERFACE (CDC_ACM_INTERFACE, 1 , CDC_COMMUNICATION_INTERFACE_CLASS, CDC_ABSTRACT_CONTROL_MODEL, 0 ),
@@ -79,17 +77,23 @@ static const CDCDescriptor _cdcInterface = {
79
77
};
80
78
_Pragma (" pack()" )
81
79
82
- const void * CDC_GetInterface (void )
80
+ const void * _CDC_GetInterface (void )
83
81
{
84
82
return &_cdcInterface;
85
83
}
86
84
87
- uint32_t CDC_GetInterfaceLength (void )
85
+ uint32_t _CDC_GetInterfaceLength (void )
88
86
{
89
87
return sizeof (_cdcInterface);
90
88
}
91
89
92
- bool CDC_Setup (Setup& setup)
90
+ int CDC_GetInterface (uint8_t * interfaceNum)
91
+ {
92
+ interfaceNum[0 ] += 2 ; // uses 2
93
+ return USBDevice.sendControl (&_cdcInterface,sizeof (_cdcInterface));
94
+ }
95
+
96
+ bool CDC_Setup (USBSetup& setup)
93
97
{
94
98
uint8_t requestType = setup.bmRequestType ;
95
99
uint8_t r = setup.bRequest ;
@@ -181,7 +185,7 @@ int Serial_::available(void)
181
185
return CDC_SERIAL_BUFFER_SIZE;
182
186
}
183
187
if (buffer->head == buffer->tail ) {
184
- USB->DEVICE .DeviceEndpoint [2 ].EPINTENSET .reg = USB_DEVICE_EPINTENCLR_TRCPT (1 );
188
+ USB->DEVICE .DeviceEndpoint [CDC_ENDPOINT_OUT ].EPINTENSET .reg = USB_DEVICE_EPINTENCLR_TRCPT (1 );
185
189
}
186
190
return (uint32_t )(CDC_SERIAL_BUFFER_SIZE + buffer->head - buffer->tail ) % CDC_SERIAL_BUFFER_SIZE;
187
191
}
0 commit comments