Minor change.

Dependents:   nanoNucleo_Serial-Bluetooth_test

Fork of HC-05 by Jesper Jakobsen

Revision:
1:703352bac629
Parent:
0:e0c6e95761d2
Child:
2:10334c0d9835
--- a/HC05.cpp	Thu Feb 04 20:18:06 2016 +0000
+++ b/HC05.cpp	Thu Feb 04 21:25:00 2016 +0000
@@ -3,22 +3,16 @@
 
 HC05::HC05(PinName tx, PinName rx): myBT(tx, rx)
 {
-myBT.baud(9600);
-
-index = 0;
-
-started = false;
-ended = false;   
+    myBT.baud(9600);
+    
+    index = 0;
+    
+    started = false;
+    ended = false;   
 }
 
-void HC05::getValue(int16_t* x, int16_t* y, int16_t* c)
-{      
-    if(!myBT.readable())
-    {
-        *x = 0;
-        *y = 0;
-        *c = 0;
-    }  
+bool HC05::getValue(int16_t* x, int16_t* y, int16_t* c)
+{   
     while(myBT.readable())
     {
         btChar = myBT.getc();
@@ -45,6 +39,9 @@
             }
         }
     }
+    *x=0;
+    *y=0;
+    *c=0;
     
     if(started && ended)
     {
@@ -77,6 +74,9 @@
         started = false;
         ended = false;
         index = 0;
-        btData[index] = '\0';             
+        btData[index] = '\0';    
+          
+        return true;     
     }
+    return false; 
 }
\ No newline at end of file