Lizzy project

Dependencies:   aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT

Files at this revision

API Documentation at this revision

Comitter:
dbartolovic
Date:
Fri Mar 09 18:09:57 2018 +0000
Parent:
4:49b1aeca55e4
Child:
6:55607d577a42
Commit message:
Set acc mode to high resolution

Changed in this revision

Lis2dh12.lib Show annotated file Show diff for this revision Revisions of this file
aconno_ble/aconno_ble.h Show annotated file Show diff for this revision Revisions of this file
source/main.cpp Show annotated file Show diff for this revision Revisions of this file
source/main.h Show annotated file Show diff for this revision Revisions of this file
--- a/Lis2dh12.lib	Fri Mar 09 17:05:05 2018 +0000
+++ b/Lis2dh12.lib	Fri Mar 09 18:09:57 2018 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/jurica238814/code/Lis2dh12/#15d1c73137e8
+https://os.mbed.com/users/jurica238814/code/Lis2dh12/#b7e3a0c1210b
--- a/aconno_ble/aconno_ble.h	Fri Mar 09 17:05:05 2018 +0000
+++ b/aconno_ble/aconno_ble.h	Fri Mar 09 18:09:57 2018 +0000
@@ -25,7 +25,7 @@
             int16_t gyroscope[3];
             int16_t accelerometer[3];
             int16_t magnetometer[3];
-            int16_t acc_lsb_value;
+            uint16_t acc_lsb_value;
         };
         struct{
             float temperature;
--- a/source/main.cpp	Fri Mar 09 17:05:05 2018 +0000
+++ b/source/main.cpp	Fri Mar 09 18:09:57 2018 +0000
@@ -42,12 +42,12 @@
         advertisementPacket.magnetometer[2] = (int16_t)0;
         
         
-        advertisementPacket.accelerometer[0] = (int16_t)mems.readXAxis()*LSB_VALUE;
-        advertisementPacket.accelerometer[1] = (int16_t)mems.readYAxis()*LSB_VALUE;
-        advertisementPacket.accelerometer[2] = (int16_t)mems.readZAxis()*LSB_VALUE;
+        advertisementPacket.accelerometer[0] = (int16_t)mems.readXAxis();
+        advertisementPacket.accelerometer[1] = (int16_t)mems.readYAxis();
+        advertisementPacket.accelerometer[2] = (int16_t)mems.readZAxis();
         
         //advertisementPacket.acc_lsb_value = 0xC000;
-        advertisementPacket.acc_lsb_value = 0x1000;
+        advertisementPacket.acc_lsb_value = 0x0100;
         
         
         printf("%6d\t", advertisementPacket.accelerometer[0]);
@@ -76,9 +76,9 @@
             redLed = 0;
         #endif
         ble->gap().startAdvertising();
-        wait_ms(1000);
+        //wait_ms(1000);
         
-        //wait_ms(MEASURE_INTERVAL_MS);
+        wait_ms(MEASURE_INTERVAL_MS);
         //wait_ms(1000);
         
         //printf("Ble advertisement is OFF.\r\n\r\n");
@@ -92,7 +92,7 @@
         advetisementData.updateData(advetisementData.MANUFACTURER_SPECIFIC_DATA, (uint8_t *)&advertisementPacket, sizeof(advertising_packet));
         ble->setAdvertisingData(advetisementData);
         */
-        wait_ms(1000);
+        //wait_ms(100);
     }
 }
 
@@ -118,8 +118,8 @@
     BLE &ble = BLE::Instance();
     ble.init(bleInitComplete);
     
-    mems.setMode(LOW_POWER);
-    //mems.setMode(HIGH_RES);
+    //mems.setMode(LOW_POWER);
+    mems.setMode(HIGH_RES);
     mems.enableAxes(X_axis);
     mems.enableAxes(Y_axis);
     mems.enableAxes(Z_axis);    
--- a/source/main.h	Fri Mar 09 17:05:05 2018 +0000
+++ b/source/main.h	Fri Mar 09 18:09:57 2018 +0000
@@ -15,11 +15,11 @@
 #include "GapAdvertisingData.h"
 
 #define DEBUG               (0)
-#define PRINT_ON_RTT        (0)
-#define DEBUG_LED           (0)
+#define PRINT_ON_RTT        (1)
+#define DEBUG_LED           (1)
 #define NANO_MODULE         (0)
 //#define LSB_VALUE           (192)
-#define LSB_VALUE           (16)
+#define LSB_VALUE           (1)
 
 #if NANO_MODULE
     #define I2C_DATA            (p2)
@@ -39,7 +39,7 @@
 
 #define BLE_ACTIVE_TIME_S   (0.4)
 #define POWER_UP_DELAY_MS   (200)
-#define MEASURE_INTERVAL_MS (250)
+#define MEASURE_INTERVAL_MS (100)
 
 #if PRINT_ON_RTT
     #include "SEGGER_RTT.h"