From 715bfd784d92497e6d78c1c1f8b24912abba5cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Sun, 17 Apr 2016 12:11:12 +0200 Subject: [PATCH] fix double USB transmit --- lib/usb_cdcacm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/usb_cdcacm.c b/lib/usb_cdcacm.c index 9314fc0..d4a34a9 100644 --- a/lib/usb_cdcacm.c +++ b/lib/usb_cdcacm.c @@ -403,7 +403,9 @@ void cdcacm_putchar(char c) tx_buffer[(tx_i+tx_used)%LENGTH(tx_buffer)] = c; // overwrite old data } mutex_unlock(&tx_lock); // release lock - usbd_ep_write_packet(usb_device, 0x82, NULL, 0); // trigger tx callback + if (tx_used==1) { // to buffer is not empty anymore + usbd_ep_write_packet(usb_device, 0x82, NULL, 0); // trigger tx callback + } } /** @brief USB interrupt service routine called when data is received */