move tud cdc write flush to yield(), add yield() to Stream timeRead(), timePeek()

This commit is contained in:
hathach committed 2019-05-28 18:24:33 +07:00
1 parent 36f5be1c52
commit f5aeb3820d
5 files changed
+13 -18

No files matched your search

+2
View File
@@ -35,6 +35,7 @@ int Stream::timedRead()
do {
c = read();
if (c >= 0) return c;
yield(); // running TinyUSB task
} while(millis() - _startMillis < _timeout);
return -1; // -1 indicates timeout
}
@@ -47,6 +48,7 @@ int Stream::timedPeek()
do {
c = peek();
if (c >= 0) return c;
yield(); // running TinyUSB task
} while(millis() - _startMillis < _timeout);
return -1; // -1 indicates timeout
}