summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
Diffstat (limited to 'src/class')
-rw-r--r--src/class/cdc/cdc_device.c3
-rw-r--r--src/class/cdc/cdc_device.h3
2 files changed, 6 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
diff --git a/src/class/cdc/cdc_device.h b/src/class/cdc/cdc_device.h
index a2523d8d0..13b59416b 100644
--- a/src/class/cdc/cdc_device.h
+++ b/src/class/cdc/cdc_device.h
@@ -128,6 +128,9 @@ TU_ATTR_WEAK void tud_cdc_rx_cb(uint8_t itf);
// Invoked when received `wanted_char`
TU_ATTR_WEAK void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char);
+// Invoked when space becomes available in TX buffer
+TU_ATTR_WEAK void tud_cdc_tx_cb(uint8_t itf);
+
// Invoked when line state DTR & RTS are changed via SET_CONTROL_LINE_STATE
TU_ATTR_WEAK void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts);