/* Reads data received over the USB CDC ACM Virtual COM Port. 
The function reads data from the receive intermediate buffer that was received over the Virtual COM Port. */
int32_t USBD_CDC_ACM_DataRead(uint8_t *buf, int32_t len)
/* Reads data received over the USB CDC ACM Virtual COM Port. 
The function reads data from the receive intermediate buffer that was received over the Virtual COM Port. */
int32_t USBD_CDC_ACM_DataRead(uint8_t *buf, int32_t len)
{
    int32_t len_data;
    if (ptr_data_received > ptr_data_read) {
        len_data = ptr_data_received - ptr_data_read;
        if (len > len_data) {
            len = len_data;
        }
        memcpy(buf, ptr_data_read, len);
        ptr_data_read      += len;
    } else {
        len = 0;
    }
    return (len);
}