Skip to content

Commit 3438949

Browse files
committed
yield() if needed when calling Serial.write()
1 parent a899505 commit 3438949

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

cores/arduino/Adafruit_TinyUSB_Core/Adafruit_TinyUSB_Core.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ extern "C"
138138
{
139139

140140
void yield(void)
141-
142141
{
143142
tud_task();
144143
tud_cdc_write_flush();

cores/arduino/Adafruit_TinyUSB_Core/Adafruit_USBD_CDC.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,8 @@ size_t Adafruit_USBD_CDC::write(const uint8_t *buffer, size_t size)
113113
remain -= wrcount;
114114
buffer += wrcount;
115115

116-
// Write FIFO is full, flush and re-try
117-
if ( remain )
118-
{
119-
tud_cdc_write_flush();
120-
}
116+
// Write FIFO is full, run usb background to flush
117+
if ( remain ) yield();
121118
}
122119

123120
return size - remain;

0 commit comments

Comments
 (0)