mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-22 08:04:07 +08:00
check for usb busy
This commit is contained in:
@@ -36,7 +36,6 @@ int _write(int file, char *data, int len) {
|
||||
if (len > UART_TX_BUFFER_SIZE)
|
||||
return 0;
|
||||
// Check if transfer is already ongoing
|
||||
// TODO: use HAL_UART_GetState
|
||||
if(huart4.gState != HAL_UART_STATE_READY)
|
||||
return 0;
|
||||
// memcpy data into uart_tx_buf
|
||||
|
||||
+4
-1
@@ -300,7 +300,10 @@ uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
|
||||
//Check length
|
||||
if (Len > APP_TX_DATA_SIZE)
|
||||
return USBD_FAIL;
|
||||
// TODO: check busy
|
||||
// Check for ongoing transmission
|
||||
USBD_CDC_HandleTypeDef* hcdc = (USBD_CDC_HandleTypeDef*) hUsbDeviceFS.pClassData;
|
||||
if (hcdc->TxState != 0)
|
||||
return USBD_BUSY;
|
||||
// memcpy Buf into UserTxBufferFS
|
||||
memcpy(UserTxBufferFS, Buf, Len);
|
||||
// Update Len
|
||||
|
||||
Reference in New Issue
Block a user