Alexandre Lemay / Mbed 2 deprecated APP4_FunTimes

Dependencies:   mbed mbed-rtos

Revision:
8:7c56fb1ed8c0
Parent:
7:332766fb3114
Child:
9:8f479f7c1b54
--- a/Receiver.cpp	Tue Oct 24 07:04:28 2017 +0000
+++ b/Receiver.cpp	Wed Oct 25 04:17:42 2017 +0000
@@ -14,7 +14,10 @@
 
 char Receiver::getNext()
 {
-    dataReady.wait();
+    if(dataReady.wait(2)==0)
+    {
+        return BitData::timeout;
+    }
     char val = data[currentData];
     currentData++;
     if(currentData==size)
@@ -136,8 +139,9 @@
     //data
     for(int i = 0; i < length; i++)
     {
-        if(!getByte(byte))
-        return false;
+        if(!getByte(byte)){
+            return false;
+        }
         message.push_back(byte);
         frame.push_back(byte);
     }