diff options
Diffstat (limited to 'stm32cubemx/Src/usbd_cdc_if.c')
-rw-r--r-- | stm32cubemx/Src/usbd_cdc_if.c | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/stm32cubemx/Src/usbd_cdc_if.c b/stm32cubemx/Src/usbd_cdc_if.c index a468e94..6e6d192 100644 --- a/stm32cubemx/Src/usbd_cdc_if.c +++ b/stm32cubemx/Src/usbd_cdc_if.c @@ -4,37 +4,37 @@ * @brief : ****************************************************************************** * - * Copyright (c) 2017 STMicroelectronics International N.V. + * Copyright (c) 2017 STMicroelectronics International N.V. * All rights reserved. * - * Redistribution and use in source and binary forms, with or without + * Redistribution and use in source and binary forms, with or without * modification, are permitted, provided that the following conditions are met: * - * 1. Redistribution of source code must retain the above copyright notice, + * 1. Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of other - * contributors to this software may be used to endorse or promote products + * 3. Neither the name of STMicroelectronics nor the names of other + * contributors to this software may be used to endorse or promote products * derived from this software without specific written permission. - * 4. This software, including modifications and/or derivative works of this + * 4. This software, including modifications and/or derivative works of this * software, must execute solely and exclusively on microcontroller or * microprocessor devices manufactured by or for STMicroelectronics. - * 5. Redistribution and use of this software other than as permitted under - * this license is void and will automatically terminate your rights under - * this license. + * 5. Redistribution and use of this software other than as permitted under + * this license is void and will automatically terminate your rights under + * this license. * - * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY - * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT + * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * @@ -50,7 +50,7 @@ * @{ */ -/** @defgroup USBD_CDC +/** @defgroup USBD_CDC * @brief usbd core module * @{ */ @@ -174,7 +174,7 @@ static int8_t CDC_DeInit_FS(void) /** * @brief CDC_Control_FS * Manage the CDC class requests - * @param cmd: Command code + * @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 @@ -186,42 +186,42 @@ static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length) { case CDC_SEND_ENCAPSULATED_COMMAND: - break; + break; case CDC_GET_ENCAPSULATED_RESPONSE: - break; + break; - case CDC_SET_COMM_FEATURE: + case CDC_SET_COMM_FEATURE: - break; + break; - case CDC_GET_COMM_FEATURE: + case CDC_GET_COMM_FEATURE: - break; + break; - case CDC_CLEAR_COMM_FEATURE: + case CDC_CLEAR_COMM_FEATURE: - break; + break; - /*******************************************************************************/ - /* Line Coding Structure */ - /*-----------------------------------------------------------------------------*/ - /* Offset | Field | Size | Value | Description */ - /* 0 | dwDTERate | 4 | Number |Data terminal rate, in bits per second*/ - /* 4 | bCharFormat | 1 | Number | Stop bits */ - /* 0 - 1 Stop bit */ - /* 1 - 1.5 Stop bits */ - /* 2 - 2 Stop bits */ - /* 5 | bParityType | 1 | Number | Parity */ - /* 0 - None */ - /* 1 - Odd */ - /* 2 - Even */ - /* 3 - Mark */ - /* 4 - Space */ - /* 6 | bDataBits | 1 | Number Data bits (5, 6, 7, 8 or 16). */ - /*******************************************************************************/ - case CDC_SET_LINE_CODING: { + /*******************************************************************************/ + /* Line Coding Structure */ + /*-----------------------------------------------------------------------------*/ + /* Offset | Field | Size | Value | Description */ + /* 0 | dwDTERate | 4 | Number |Data terminal rate, in bits per second*/ + /* 4 | bCharFormat | 1 | Number | Stop bits */ + /* 0 - 1 Stop bit */ + /* 1 - 1.5 Stop bits */ + /* 2 - 2 Stop bits */ + /* 5 | bParityType | 1 | Number | Parity */ + /* 0 - None */ + /* 1 - Odd */ + /* 2 - Even */ + /* 3 - Mark */ + /* 4 - Space */ + /* 6 | bDataBits | 1 | Number Data bits (5, 6, 7, 8 or 16). */ + /*******************************************************************************/ + case CDC_SET_LINE_CODING: { uint32_t bps = pbuf[0] << 24 | pbuf[1] << 16 | pbuf[2] << 8 | pbuf[3]; const char *stop_bits = pbuf[4] == 0 ? "1" : pbuf[4] == 1 ? "1.5" : "2"; const char *parities[5] = {"none", "odd", "even", "mark", "space"}; @@ -229,22 +229,22 @@ static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length) int bits = pbuf[6]; printf("Line coding, bps=%lu, bits=%s, parity=%s, bits=%d\n", bps, stop_bits, parity, bits); } - break; + break; - case CDC_GET_LINE_CODING: + case CDC_GET_LINE_CODING: - break; + break; - case CDC_SET_CONTROL_LINE_STATE: + case CDC_SET_CONTROL_LINE_STATE: - break; + break; - case CDC_SEND_BREAK: + case CDC_SEND_BREAK: - break; + break; - default: - break; + default: + break; } return (USBD_OK); @@ -253,15 +253,15 @@ static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length) /** * @brief CDC_Receive_FS - * Data received over USB OUT endpoint are sent over CDC interface + * Data received over USB OUT endpoint are sent over CDC interface * through this function. - * + * * @note - * This function will block any OUT packet reception on USB endpoint + * This function will block any OUT packet reception on USB endpoint * untill exiting this function. If you exit this function before transfer - * is complete on CDC interface (ie. using DMA controller) it will result + * is complete on CDC interface (ie. using DMA controller) it will result * in receiving more data while previous ones are still not sent. - * + * * @param Buf: Buffer of data to be received * @param Len: Number of data received (in bytes) * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL @@ -284,11 +284,11 @@ static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len) /** * @brief CDC_Transmit_FS - * Data send over USB IN endpoint are sent over CDC interface - * through this function. + * Data send over USB IN endpoint are sent over CDC interface + * through this function. * @note - * - * + * + * * @param Buf: Buffer of data to be send * @param Len: Number of data to be send (in bytes) * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL or USBD_BUSY |