From 80d5fd1f5118428857de730728233eb7d174a1a2 Mon Sep 17 00:00:00 2001 From: Andrew J Meyer Date: Fri, 1 Jul 2011 16:28:40 -0400 Subject: fixed a bug in usbreceivebytes bug prevented consecutive SerialUSB.read() calls from returning consecutive bytes --- libmaple/usb/usb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libmaple/usb/usb.c b/libmaple/usb/usb.c index 617c1ee..651b36e 100644 --- a/libmaple/usb/usb.c +++ b/libmaple/usb/usb.c @@ -376,21 +376,25 @@ uint32 usbBytesAvailable(void) { will only copy the minimum of len or the available bytes. returns the number of bytes copied */ uint32 usbReceiveBytes(uint8* recvBuf, uint32 len) { + static int offset = 0; + if (len > newBytes) { len = newBytes; } int i; for (i=0;i