aboutsummaryrefslogtreecommitdiff
path: root/ports/stm32/usbd_cdc_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/stm32/usbd_cdc_interface.c')
-rw-r--r--ports/stm32/usbd_cdc_interface.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ports/stm32/usbd_cdc_interface.c b/ports/stm32/usbd_cdc_interface.c
index 586f2d525..4a4a8beb8 100644
--- a/ports/stm32/usbd_cdc_interface.c
+++ b/ports/stm32/usbd_cdc_interface.c
@@ -64,14 +64,14 @@ static uint8_t usbd_cdc_connect_tx_timer;
uint8_t *usbd_cdc_init(usbd_cdc_state_t *cdc_in) {
usbd_cdc_itf_t *cdc = (usbd_cdc_itf_t*)cdc_in;
- // Reset all the CDC state
- // Note: we don't reset tx_buf_ptr_in in order to allow the output buffer to
- // be filled (by usbd_cdc_tx_always) before the USB device is connected.
+ // Reset the CDC state due to a new USB host connection
+ // Note: we don't reset tx_buf_ptr_* in order to allow the output buffer to
+ // be filled (by usbd_cdc_tx_always) before the USB device is connected, and
+ // to retain transmit buffer state across multiple USB connections (they will
+ // be 0 at MCU reset since the variables live in the BSS).
cdc->rx_buf_put = 0;
cdc->rx_buf_get = 0;
cdc->rx_buf_full = false;
- cdc->tx_buf_ptr_out = 0;
- cdc->tx_buf_ptr_out_shadow = 0;
cdc->tx_need_empty_packet = 0;
cdc->connect_state = USBD_CDC_CONNECT_STATE_DISCONNECTED;