quadcopter3/quadcopter1/USB_DEVICE/App/usbd_cdc_if.c
/**
  * @brief  CDC_Transmit_FS
  *         Data to send over USB IN endpoint are sent over CDC interface
  *         through this function.
  *         @note
  *
  *
  * @param  Buf: Buffer of data to be sent
  * @param  Len: Number of data to be sent (in bytes)
  * @retval USBD_OK if all operations are OK else USBD_FAIL or USBD_BUSY
  */
@brief  CDC_Transmit_FS
Data to send over USB IN endpoint are sent over CDC interface
through this function.
@note

@param  Buf: Buffer of data to be sent
@param  Len: Number of data to be sent (in bytes)
@retval USBD_OK if all operations are OK else USBD_FAIL or USBD_BUSY
@brief CDC_Transmit_FS Data to send over USB IN endpoint are sent over CDC interface through this function . @note @param Buf : Buffer of data to be sent @param Len : Number of data to be sent ( in bytes ) @retval USBD_OK if all operations are OK else USBD_FAIL or USBD_BUSY
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
{
  uint8_t result = USBD_OK;
  uint32_t TimeStart = HAL_GetTick();
  USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;
  while(hcdc->TxState)
  {
      if(HAL_GetTick()-TimeStart > 10)
	return USBD_BUSY;
      else
	break;
  }
  USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);
  result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);
  TimeStart = HAL_GetTick();
  while(hcdc->TxState)
    {
        if(HAL_GetTick()-TimeStart > 10)
          return USBD_BUSY;
    }
  return result;
}
uint8_t CDC_Transmit_FS ( uint8_t * Buf , uint16_t Len ) { uint8_t result = USBD_OK ; uint32_t TimeStart = HAL_GetTick ( ) ; USBD_CDC_HandleTypeDef * hcdc = ( USBD_CDC_HandleTypeDef * ) hUsbDeviceFS . pClassData ; while ( hcdc -> TxState ) { if ( HAL_GetTick ( ) - TimeStart > 10 ) return USBD_BUSY ; else break ; } USBD_CDC_SetTxBuffer ( & hUsbDeviceFS , Buf , Len ) ; result = USBD_CDC_TransmitPacket ( & hUsbDeviceFS ) ; TimeStart = HAL_GetTick ( ) ; while ( hcdc -> TxState ) { if ( HAL_GetTick ( ) - TimeStart > 10 ) return USBD_BUSY ; } return result ; }
@brief  CDC_Transmit_FS
         Data to send over USB IN endpoint are sent over CDC interface
         through this function.
@brief CDC_Transmit_FS Data to send over USB IN endpoint are sent over CDC interface through this function .
/* USER CODE BEGIN 7 */ //if (hcdc->TxState != 0) return USBD_BUSY; /* USER CODE END 7 */