aboutsummaryrefslogtreecommitdiffstats
path: root/core/usb/usb.c
diff options
context:
space:
mode:
authorAJM <poslathian@poslathian.(none)>2010-04-25 15:52:04 -0400
committerbnewbold <bnewbold@robocracy.org>2010-05-20 22:09:15 -0400
commitcd172b2d5ed1ff486eab399e4da5af8315cddc8b (patch)
treedefac04445f8b4a9e933132aada4dba56c76285b /core/usb/usb.c
parent8d6602547bc7beb39652a35a1cfdddc250f683ff (diff)
downloadlibrambutan-cd172b2d5ed1ff486eab399e4da5af8315cddc8b.tar.gz
librambutan-cd172b2d5ed1ff486eab399e4da5af8315cddc8b.zip
fixed the FIFO bug, tx/rx now seems stable and ready for integration.
Diffstat (limited to 'core/usb/usb.c')
-rw-r--r--core/usb/usb.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/usb/usb.c b/core/usb/usb.c
index f20f144..da0f37a 100644
--- a/core/usb/usb.c
+++ b/core/usb/usb.c
@@ -402,7 +402,8 @@ uint8 usbReceiveBytes(uint8* recvBuf, uint8 len) {
int i;
for (i=0;i<len;i++) {
- recvBuf[i] = (uint8)(vcomBufferRx[(recvBufOut++)%VCOM_RX_EPSIZE]);
+ recvBuf[i] = (uint8)(vcomBufferRx[recvBufOut]);
+ recvBufOut = (recvBufOut + 1) % VCOM_RX_EPSIZE;
}
maxNewBytes += len;
@@ -412,9 +413,12 @@ uint8 usbReceiveBytes(uint8* recvBuf, uint8 len) {
void usbSendHello(void) {
char* myStr = "hello!";
- uint8 thisVal = 48 + usbBytesAvailable();
+ uint8 bufin = 48 + recvBufIn;;
+ uint8 bufout = 48 + recvBufOut;
+
char *line = "\n";
- while(usbSendBytes(&thisVal,1) == 0);
+ while(usbSendBytes(&bufin,1) == 0);
+ while(usbSendBytes(&bufout,1) == 0);
while(usbSendBytes((uint8*)line,1) == 0);
uint8 recv[64];