Ble Demo with Raspberry PI updated

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_DEMO_SPI by HM_IOT_Demo

Files at this revision

API Documentation at this revision

Comitter:
venubk
Date:
Tue Oct 17 10:40:59 2017 +0000
Parent:
20:671b7e0ba5f3
Commit message:
working enegy meter data from ble to mdot

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 671b7e0ba5f3 -r a73c37ae9e7e main.cpp
--- a/main.cpp	Mon Oct 16 05:28:06 2017 +0000
+++ b/main.cpp	Tue Oct 17 10:40:59 2017 +0000
@@ -427,6 +427,7 @@
     
     spiSlave.reply(12);
 
+    read_bufferSize = 0;
     while(1)
     {
         pc.printf("loop\r\n");
@@ -444,7 +445,7 @@
       
         if(connect_status && charDiscover)
         {
-            read_bufferSize = 0;
+            //read_bufferSize = 0;
             if(read_flag)
             {
                 pc.printf("Read\r\n");
@@ -463,12 +464,15 @@
                         //if(read_bufferSize < receiveBufSize)
                          //   break;
                         
-                        if(checkBytes(read_temp_data))
-                            break;
+                        //vif(checkBytes(read_temp_data))
+                         //v   break;
                             
                         read_temp_data = spiSlave.read();
-                        spiSlave.reply(0x02);//read_buffer[read_bufferSize]
-                        read_bufferSize++;   
+                        if(read_temp_data == 0xAA)
+                        {
+                            spiSlave.reply(read_buffer[read_bufferSize]);
+                            read_bufferSize++;   
+                        }