Merge pull request #2629 from andrewleech/cdc-persistent-tx-buffer

Add option to make CDC TX buffer persistent.
This commit is contained in:
HiFiPhile 2024-05-08 12:17:45 +02:00 committed by GitHub
commit c773c612fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -295,7 +295,9 @@ void cdcd_reset(uint8_t rhport)
tu_memclr(p_cdc, ITF_MEM_RESET_SIZE);
tu_fifo_clear(&p_cdc->rx_ff);
#if !CFG_TUD_CDC_PERSISTENT_TX_BUFF
tu_fifo_clear(&p_cdc->tx_ff);
#endif
tu_fifo_set_overwritable(&p_cdc->tx_ff, true);
}
}

View File

@ -41,6 +41,12 @@
#define CFG_TUD_CDC_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#endif
// By default the TX fifo buffer is cleared on connect / bus reset.
// Enable this to persist any data in the fifo instead.
#ifndef CFG_TUD_CDC_PERSISTENT_TX_BUFF
#define CFG_TUD_CDC_PERSISTENT_TX_BUFF (0)
#endif
#ifdef __cplusplus
extern "C" {
#endif