- uint8_t* LineCodingData = (uint8_t*)&LineCoding;\r
-\r
- /* Process CDC specific control requests */\r
- switch (bRequest)\r
- {\r
- case REQ_GetLineEncoding:\r
- if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
- { \r
- /* Acknowledge the SETUP packet, ready for data transfer */\r
- Endpoint_ClearSetupReceived();\r
-\r
- /* Write the line coding data to the control endpoint */\r
- Endpoint_Write_Control_Stream_LE(LineCodingData, sizeof(LineCoding));\r
- \r
- /* Finalize the stream transfer to send the last packet or clear the host abort */\r
- Endpoint_ClearSetupOUT();\r
- }\r
- \r
- break;\r
- case REQ_SetLineEncoding:\r
- if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
- {\r
- /* Acknowledge the SETUP packet, ready for data transfer */\r
- Endpoint_ClearSetupReceived();\r
-\r
- /* Read the line coding data in from the host into the global struct */\r
- Endpoint_Read_Control_Stream_LE(LineCodingData, sizeof(LineCoding));\r
-\r
- /* Finalize the stream transfer to clear the last packet from the host */\r
- Endpoint_ClearSetupIN();\r
- \r
- /* Reconfigure the USART with the new settings */\r
- ReconfigureUSART();\r
- }\r
- \r
- break;\r
- case REQ_SetControlLineState:\r
- if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
- {\r
-#if 0\r
- /* NOTE: Here you can read in the line state mask from the host, to get the current state of the output handshake\r
- lines. The mask is read in from the wValue parameter, and can be masked against the CONTROL_LINE_OUT_* masks\r
- to determine the RTS and DTR line states using the following code:\r
- */\r
-\r
- uint16_t wIndex = Endpoint_Read_Word_LE();\r
- \r
- // Do something with the given line states in wIndex\r
-#endif\r
- \r
- /* Acknowledge the SETUP packet, ready for data transfer */\r
- Endpoint_ClearSetupReceived();\r
- \r
- /* Acknowledge status stage */\r
- while (!(Endpoint_IsSetupINReady()));\r
- Endpoint_ClearSetupIN();\r
- }\r
- \r
- break;\r
- }\r