diff options
| author | Gavin Li <[email protected]> | 2020-06-18 01:13:44 -0700 |
|---|---|---|
| committer | Gavin Li <[email protected]> | 2020-06-18 01:13:44 -0700 |
| commit | 8fe887198b63520c23af9f4c27d9733f6bb18e90 (patch) | |
| tree | 90be0e9b3b7602baf7a6ed7646fe99236575d802 /src/class/cdc/cdc_device.c | |
| parent | 2b27eed01aa25d12c7e78414875d83e9c2604830 (diff) | |
Add tx callback to cdc device
Useful for continuous transmission of data, which is difficult currently
because there is no notification of tx completion.
Diffstat (limited to 'src/class/cdc/cdc_device.c')
| -rw-r--r-- | src/class/cdc/cdc_device.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c index 9180065c4..b979b11f1 100644 --- a/src/class/cdc/cdc_device.c +++ b/src/class/cdc/cdc_device.c @@ -416,6 +416,9 @@ 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 ) { + // invoke transmit callback to possibly refill tx fifo + if ( tud_cdc_tx_cb && !tu_fifo_full(&p_cdc->tx_ff) ) tud_cdc_tx_cb(itf); + if ( 0 == tud_cdc_n_write_flush(itf) ) { // There is no data left, a ZLP should be sent if |
