xx

Revision:
13:6a4969d25627
Parent:
11:04d8899b5d82
--- a/UARTserial_mio/UARTSerial_mio.cpp	Wed Nov 06 10:57:21 2019 +0000
+++ b/UARTserial_mio/UARTSerial_mio.cpp	Tue Sep 14 12:09:42 2021 +0000
@@ -257,7 +257,7 @@
 
     api_lock();
 
-    while (_rxbuf.size()!=length) {
+    while (_rxbuf.size()!=length && tm<=timeout) {
         if (!_blocking) {
             api_unlock();
             return -EAGAIN;
@@ -270,10 +270,11 @@
     }
     
     //printf("tm: %f\r\n",tm);
-
-    while (data_read < length && !_rxbuf.empty()) {
+    tm = 0.0;
+    while (data_read < length && !_rxbuf.empty()  && tm<=timeout) {
         _rxbuf.pop(*ptr++);
         data_read++;
+        tm = tm + 0.001; //10/1000
     }
 
     core_util_critical_section_enter();