Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @brief Manage the CDC class requests
- * @param cmd: Command code
- * @param pbuf: Buffer containing command data (request parameters)
- * @param length: Number of data to be sent (in bytes)
- * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
- */
- static int8_t CDC_Control_FS(uint8_t cmd, uint8_t* pbuf, uint16_t length)
- {
- /* USER CODE BEGIN 10 */
- USBD_CDC_LineCodingTypeDef linecoding = {
- 9600, /* baud rate*/
- 0x00, /* stop bits-1*/
- 0x00, /* parity - none*/
- 0x08 /* nb. of bits 8*/
- };
- switch (cmd) {
- case CDC_SET_LINE_CODING:
- linecoding.bitrate = (uint32_t) (pbuf[0] | (pbuf[1] << 8)
- | (pbuf[2] << 16) | (pbuf[3] << 24));
- linecoding.format = pbuf[4];
- linecoding.paritytype = pbuf[5];
- linecoding.datatype = pbuf[6];
- break;
- case CDC_GET_LINE_CODING:
- pbuf[0] = (uint8_t) (linecoding.bitrate);
- pbuf[1] = (uint8_t) (linecoding.bitrate >> 8);
- pbuf[2] = (uint8_t) (linecoding.bitrate >> 16);
- pbuf[3] = (uint8_t) (linecoding.bitrate >> 24);
- pbuf[4] = linecoding.format;
- pbuf[5] = linecoding.paritytype;
- pbuf[6] = linecoding.datatype;
- break;
- /* case CDC_SEND_ENCAPSULATED_COMMAND:
- case CDC_GET_ENCAPSULATED_RESPONSE:
- case CDC_SET_COMM_FEATURE:
- case CDC_GET_COMM_FEATURE:
- case CDC_CLEAR_COMM_FEATURE:
- case CDC_SET_CONTROL_LINE_STATE:
- case CDC_SEND_BREAK: */
- default:
- break;
- }
- return (USBD_OK);
- /* USER CODE END 10 */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement