From b2102c88154ac1f445da05e71517e8c086094daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Schneider?= Date: Sat, 19 Feb 2022 00:00:45 +0100 Subject: [PATCH] Fix USBDevice.connected() * Fix arduino/ArduinoCore-samd#661 * connected() did not return the USB connected state, but essentially a random value. --- cores/arduino/USB/USBCore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index f8322436f..5f22739fb 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -480,8 +480,8 @@ void USBDeviceClass::stall(uint32_t ep) bool USBDeviceClass::connected() { // Count frame numbers - uint8_t f = USB->DEVICE.FNUM.bit.FNUM; - //delay(3); + uint16_t f = USB->DEVICE.FNUM.bit.FNUM; + delay(1); // wait for next SOF return f != USB->DEVICE.FNUM.bit.FNUM; }