Turn transmit fifo overwritable in no DTR mode
@@ -197,7 +197,7 @@ void cdcd_init(void)
// config fifo
tu_fifo_config(&p_cdc->rx_ff, p_cdc->rx_ff_buf, TU_ARRAY_SIZE(p_cdc->rx_ff_buf), 1, false);
- tu_fifo_config(&p_cdc->tx_ff, p_cdc->tx_ff_buf, TU_ARRAY_SIZE(p_cdc->tx_ff_buf), 1, false);
+ tu_fifo_config(&p_cdc->tx_ff, p_cdc->tx_ff_buf, TU_ARRAY_SIZE(p_cdc->tx_ff_buf), 1, true);
#if CFG_FIFO_MUTEX
tu_fifo_config_mutex(&p_cdc->rx_ff, osal_mutex_create(&p_cdc->rx_ff_mutex));
@@ -355,6 +355,9 @@ bool cdcd_control_request(uint8_t rhport, tusb_control_request_t const * request
p_cdc->line_state = (uint8_t) request->wValue;
+ // Disable fifo overwriting if DTR bit is set
+ p_cdc->tx_ff.overwritable = dtr ? false : true;
+
TU_LOG2(" Set Control Line State: DTR = %d, RTS = %d\r\n", dtr, rts);
tud_control_status(rhport, request);
