From f6244bbe59c46a176251125f07bca1b92daf4d6a Mon Sep 17 00:00:00 2001 From: "Andrew J. Kroll" Date: Sat, 24 May 2014 00:31:26 -0400 Subject: [PATCH] bugfix --- Usb.cpp | 6 +++--- examples/hub_demo/hub_demo.ino | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Usb.cpp b/Usb.cpp index d75149d8..ca81cf99 100644 --- a/Usb.cpp +++ b/Usb.cpp @@ -327,7 +327,7 @@ uint8_t USB::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8 regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ rcode = (regRd(rHRSL) & 0x0f); - while(rcode && ((long)(millis() - timeout) >= 0L)) { + while(rcode && ((long)(millis() - timeout) < 0L)) { switch(rcode) { case hrNAK: nak_count++; @@ -380,11 +380,11 @@ uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) { uint8_t retry_count = 0; uint16_t nak_count = 0; - while((long)(millis() - timeout) >= 0L) { + while((long)(millis() - timeout) < 0L) { regWr(rHXFR, (token | ep)); //launch the transfer rcode = USB_ERROR_TRANSFER_TIMEOUT; - while((long)(millis() - timeout) >= 0L) //wait for transfer completion + while((long)(millis() - timeout) < 0L) //wait for transfer completion { tmpdata = regRd(rHIRQ); diff --git a/examples/hub_demo/hub_demo.ino b/examples/hub_demo/hub_demo.ino index bede0f4b..329c6230 100644 --- a/examples/hub_demo/hub_demo.ino +++ b/examples/hub_demo/hub_demo.ino @@ -97,7 +97,7 @@ void loop() if( Usb.getUsbTaskState() == USB_STATE_RUNNING ) { - if ((next_time - millis()) >= 0L) + if ((millis() - next_time) >= 0L) { Usb.ForEachUsbDevice(&PrintAllDescriptors); Usb.ForEachUsbDevice(&PrintAllAddresses);