Skip to content

Commit f6244bb

Browse files
committed
bugfix
1 parent a50baa8 commit f6244bb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Usb.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ uint8_t USB::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8
327327
regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
328328
rcode = (regRd(rHRSL) & 0x0f);
329329

330-
while(rcode && ((long)(millis() - timeout) >= 0L)) {
330+
while(rcode && ((long)(millis() - timeout) < 0L)) {
331331
switch(rcode) {
332332
case hrNAK:
333333
nak_count++;
@@ -380,11 +380,11 @@ uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) {
380380
uint8_t retry_count = 0;
381381
uint16_t nak_count = 0;
382382

383-
while((long)(millis() - timeout) >= 0L) {
383+
while((long)(millis() - timeout) < 0L) {
384384
regWr(rHXFR, (token | ep)); //launch the transfer
385385
rcode = USB_ERROR_TRANSFER_TIMEOUT;
386386

387-
while((long)(millis() - timeout) >= 0L) //wait for transfer completion
387+
while((long)(millis() - timeout) < 0L) //wait for transfer completion
388388
{
389389
tmpdata = regRd(rHIRQ);
390390

examples/hub_demo/hub_demo.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void loop()
9797

9898
if( Usb.getUsbTaskState() == USB_STATE_RUNNING )
9999
{
100-
if ((next_time - millis()) >= 0L)
100+
if ((millis() - next_time) >= 0L)
101101
{
102102
Usb.ForEachUsbDevice(&PrintAllDescriptors);
103103
Usb.ForEachUsbDevice(&PrintAllAddresses);

0 commit comments

Comments
 (0)