summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-10-13 12:00:47 +1100
committerDamien George <damien.p.george@gmail.com>2017-10-13 12:00:47 +1100
commit7c7c7b161df5be99aee9dea444b6e4beacf78438 (patch)
treeed285d1cd3895868b0db5894641823ed8d5ae6a8
parentc59fc1419d5760d7be0bcad1ebdfb70b43fe7093 (diff)
stm32/usbd_cdc_interface: Don't reset CDC output buf on initialisation.
So that characters can be buffered before the USB device is connected (restoring behviour of the driver before recent state refactoring).
-rw-r--r--ports/stm32/usbd_cdc_interface.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ports/stm32/usbd_cdc_interface.c b/ports/stm32/usbd_cdc_interface.c
index 4c49c9321..2e9fba917 100644
--- a/ports/stm32/usbd_cdc_interface.c
+++ b/ports/stm32/usbd_cdc_interface.c
@@ -57,10 +57,14 @@
#define CDC_SEND_BREAK 0x23
uint8_t *usbd_cdc_init(usbd_cdc_itf_t *cdc, usbd_cdc_msc_hid_state_t *usbd) {
+ // Link the parent state
cdc->usbd = usbd;
+
+ // 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.
cdc->rx_buf_put = 0;
cdc->rx_buf_get = 0;
- cdc->tx_buf_ptr_in = 0;
cdc->tx_buf_ptr_out = 0;
cdc->tx_buf_ptr_out_shadow = 0;
cdc->tx_buf_ptr_wait_count = 0;