@@ -58,10 +58,8 @@ static volatile LineInfo _usbLineInfo = {
5858 0x00 // lineState
5959};
6060
61- static const CDCDescriptor _cdcInterface = {
62- #if (defined CDC_ENABLED) && defined(HID_ENABLED)
61+ static CDCDescriptor _cdcInterface = {
6362 D_IAD (0 , 2 , CDC_COMMUNICATION_INTERFACE_CLASS, CDC_ABSTRACT_CONTROL_MODEL, 0 ),
64- #endif
6563
6664 // CDC communication interface
6765 D_INTERFACE (CDC_ACM_INTERFACE, 1 , CDC_COMMUNICATION_INTERFACE_CLASS, CDC_ABSTRACT_CONTROL_MODEL, 0 ),
@@ -79,17 +77,23 @@ static const CDCDescriptor _cdcInterface = {
7977};
8078_Pragma (" pack()" )
8179
82- const void * CDC_GetInterface (void )
80+ const void * _CDC_GetInterface (void )
8381{
8482 return &_cdcInterface;
8583}
8684
87- uint32_t CDC_GetInterfaceLength (void )
85+ uint32_t _CDC_GetInterfaceLength (void )
8886{
8987 return sizeof (_cdcInterface);
9088}
9189
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)
9397{
9498 uint8_t requestType = setup.bmRequestType ;
9599 uint8_t r = setup.bRequest ;
@@ -181,7 +185,7 @@ int Serial_::available(void)
181185 return CDC_SERIAL_BUFFER_SIZE;
182186 }
183187 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 );
185189 }
186190 return (uint32_t )(CDC_SERIAL_BUFFER_SIZE + buffer->head - buffer->tail ) % CDC_SERIAL_BUFFER_SIZE;
187191}
0 commit comments