Преглед изворни кода

Slight optimization for cdc tx refill

Gavin Li пре 5 година
родитељ
комит
72183c7bb4
1 измењених фајлова са 1 додато и 3 уклоњено
  1. 1 3
      src/class/cdc/cdc_device.c

+ 1 - 3
src/class/cdc/cdc_device.c

@@ -416,12 +416,10 @@ bool cdcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_
   //       Though maybe the baudrate is not really important !!!
   if ( ep_addr == p_cdc->ep_in )
   {
-    uint32_t flushed = tud_cdc_n_write_flush(itf);
-
     // invoke transmit callback to possibly refill tx fifo
     if ( tud_cdc_tx_complete_cb ) tud_cdc_tx_complete_cb(itf);
 
-    if ( 0 == flushed && tu_fifo_empty(&p_cdc->tx_ff) )
+    if ( 0 == tud_cdc_n_write_flush(itf) )
     {
       // There is no data left, a ZLP should be sent if
       // xferred_bytes is multiple of EP size and not zero