Skip to content

Commit b2102c8

Browse files
committed
Fix USBDevice.connected()
* Fix arduino#661 * connected() did not return the USB connected state, but essentially a random value.
1 parent ed21e12 commit b2102c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/arduino/USB/USBCore.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,8 @@ void USBDeviceClass::stall(uint32_t ep)
480480
bool USBDeviceClass::connected()
481481
{
482482
// Count frame numbers
483-
uint8_t f = USB->DEVICE.FNUM.bit.FNUM;
484-
//delay(3);
483+
uint16_t f = USB->DEVICE.FNUM.bit.FNUM;
484+
delay(1); // wait for next SOF
485485
return f != USB->DEVICE.FNUM.bit.FNUM;
486486
}
487487

0 commit comments

Comments
 (0)