ADXL362 with BLE Nano

Dependencies:   ADXL362_v3 BLE_API mbed nRF51822

Revision:
9:ca9a58478ddd
Parent:
7:2d9b5491b2d3
--- a/main.cpp	Sun Aug 13 05:30:51 2017 +0000
+++ b/main.cpp	Tue Sep 05 06:20:07 2017 +0000
@@ -120,22 +120,21 @@
 //onTimeout
 //======================================================================
 
-/*
+
 void m_status_check_handle(void)
 {   
-
-    uint8_t buf[2];
+        //uint8_t x,y,z;
+        uint8_t x[1];
+        x[0] = adxl362.scanx_u8();
+        //y=adxl362.scany_u8();
+        //z=adxl362.scanz_u8();
+        //printf("x = %x y = %x z = %x\r\n",x,y,z);
+        //wait_ms(10);
+    
+        //Send out
+        ble.updateCharacteristicValue(rxCharacteristic.getValueAttribute().getHandle(), x, 1); 
+}
 
-    //Read Analog port
-    float s = ANALOG;
-    uint16_t value = s*1024; 
-    buf[0] = (value >> 8);
-    buf[1] = value;
-    
-    //Send out
-    ble.updateCharacteristicValue(rxCharacteristic.getValueAttribute().getHandle(), buf, 2); 
-}
-*/
 
 //======================================================================
 //convert reverse UUID
@@ -158,13 +157,12 @@
     adxl362.reset();
     wait_ms(600);      // we need to wait at least 500ms after ADXL362 reset
     adxl362.set_mode(ADXL362::MEASUREMENT);
-
-    
+   
     uint8_t base_uuid_rev[16];
 
     //Timer Setting [us]
     Ticker ticker;
-    //ticker.attach_us(m_status_check_handle, TICKER_TIME);
+    ticker.attach_us(m_status_check_handle, TICKER_TIME);
     
     //BLE init
     ble.init();
@@ -205,17 +203,6 @@
     //------------------------------------------------------------
     while(1)
     {
-        //uint8_t x,y,z;
-        uint8_t x[1];
-        x[0] = adxl362.scanx_u8();
-        //y=adxl362.scany_u8();
-        //z=adxl362.scanz_u8();
-        //printf("x = %x y = %x z = %x\r\n",x,y,z);
-        //wait_ms(10);
-    
-        //Send out
-        ble.updateCharacteristicValue(rxCharacteristic.getValueAttribute().getHandle(), x, 1); 
-        
         ble.waitForEvent(); 
     }
 }
\ No newline at end of file