We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b928d9b commit 73d1072Copy full SHA for 73d1072
cores/nRF5/Adafruit_TinyUSB_Core/Adafruit_USBD_CDC.cpp
@@ -64,12 +64,24 @@ void Adafruit_USBD_CDC::end(void)
64
65
Adafruit_USBD_CDC::operator bool()
66
{
67
- return tud_cdc_connected();
+ bool ret = tud_cdc_connected();
68
+
69
+ // Add an yield to run usb background in case sketch block wait as follows
70
+ // while( !Serial ) {}
71
+ if ( !ret ) yield();
72
73
+ return ret;
74
}
75
76
int Adafruit_USBD_CDC::available(void)
77
- return tud_cdc_available();
78
+ uint32_t count = tud_cdc_available();
79
80
81
+ // while( !Serial.available() ) {}
82
+ if (!count) yield();
83
84
+ return count;
85
86
87
int Adafruit_USBD_CDC::peek(void)
0 commit comments