aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/usb/usb_callbacks.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple/usb/usb_callbacks.c')
-rw-r--r--libmaple/usb/usb_callbacks.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libmaple/usb/usb_callbacks.c b/libmaple/usb/usb_callbacks.c
index 4cdaf73..c30d650 100644
--- a/libmaple/usb/usb_callbacks.c
+++ b/libmaple/usb/usb_callbacks.c
@@ -132,8 +132,12 @@ void vcomDataRxCb(void) {
}
maxNewBytes -= newBytes;
- SetEPRxCount(VCOM_RX_ENDP,maxNewBytes);
- SetEPRxValid(VCOM_RX_ENDP);
+
+ if (maxNewBytes > VCOM_RX_EPSIZE) {
+ SetEPRxCount(VCOM_RX_ENDP,0);
+ SetEPRxStatus(VCOM_RX_ENDP,EP_RX_NAK); /* nak until we clear the buffer */
+ }
+
}
void vcomManagementCb(void) {