Edit

Dependencies:   Lis2dh12 aconno_I2C aconno_nrf52_uart adc52832_common aconno_SEGGER_RTT

Files at this revision

API Documentation at this revision

Comitter:
jurica238814
Date:
Fri Mar 02 10:29:59 2018 +0000
Branch:
NanoModule
Parent:
12:d5d47f848af5
Commit message:
This version works ok for DICE project. ;

Changed in this revision

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
diff -r d5d47f848af5 -r 7ae1c5bcccb5 source/main.cpp
--- a/source/main.cpp	Thu Mar 01 08:55:48 2018 +0000
+++ b/source/main.cpp	Fri Mar 02 10:29:59 2018 +0000
@@ -31,11 +31,11 @@
 
 void int1Handler(){
     __disable_irq();
-    //I2C i2c(I2C_DATA,I2C_CLK);
+    I2C i2c(I2C_DATA,I2C_CLK);
     mems.clearIntFlag();
     bleT.signal_set(ACC_INT_SIG);
     bleTicker.attach(disableBle, BLE_ACTIVE_TIME_S);
-    //disableI2C();
+    disableI2C();
     __enable_irq();
     
 }
@@ -48,12 +48,14 @@
         Thread::signal_wait(ACC_INT_SIG);
         Thread::signal_clr(ACC_INT_SIG);
         //I2C i2c(I2C_DATA,I2C_CLK);
+        
         printf("\r\n\r\n**********************\r\n");
         printf("Interrupt on accelerometer.\r\n");
         printf("X acceleration data: %d [mg]\r\n", mems.readXAxis()*LSB_VALUE);
         printf("Y acceleration data: %d [mg]\r\n", mems.readYAxis()*LSB_VALUE);
         printf("Z acceleration data: %d [mg]\r\n", mems.readZAxis()*LSB_VALUE);
         printf("******************************\r\n");
+        
         //disableI2C();
         //__enable_irq();
         
@@ -107,6 +109,7 @@
     mems.enableAxes(Y_axis);
     mems.enableAxes(Z_axis);    
     mems.setODR(ODR_50Hz);
+    mems.setScale(_16g);
     mems.int1Setup(0x40);       // IntActivity 1 driven to INT1 pad
     mems.int1Latch(0x01);       // Enable int1 latch
     mems.int1Threshold(INT1_THRESHOLD); 
@@ -114,10 +117,10 @@
     mems.int1Config(0x2A);      // Enable XHigh, YHigh and ZHigh
     
     bleT.start(callback(bleF, &ble));   // Start bleT
-    measureT.start(callback(measureF));
+    //measureT.start(callback(measureF));
     
     while(1){
-        //disableI2C();
+        disableI2C();
         Thread::wait(0xFFFFFFFF);
     }
 }
diff -r d5d47f848af5 -r 7ae1c5bcccb5 source/main.h
--- a/source/main.h	Thu Mar 01 08:55:48 2018 +0000
+++ b/source/main.h	Fri Mar 02 10:29:59 2018 +0000
@@ -16,10 +16,10 @@
 #include "GapAdvertisingData.h"
 
 #define DEBUG               (0)
-#define PRINT_ON_RTT        (1)
-#define DEBUG_LED           (1)
+#define PRINT_ON_RTT        (0)
+#define DEBUG_LED           (0)
 #define NANO_MODULE         (1)
-#define LSB_VALUE           (16)
+#define LSB_VALUE           (192)
 
 #if NANO_MODULE
     #define I2C_DATA            (p2)
@@ -37,7 +37,7 @@
     #define RED_LED_PIN         (p22)
 #endif
 
-#define BLE_ACTIVE_TIME_S   (1)
+#define BLE_ACTIVE_TIME_S   (0.4)
 #define POWER_UP_DELAY_MS   (200)
 
 #if PRINT_ON_RTT
@@ -47,7 +47,7 @@
     #define printf(...)
 #endif
 
-#define INT1_THRESHOLD      (125u)
+#define INT1_THRESHOLD      (20u)
 #define INT1_DUR            (0x00)
     
 #define ACC_INT_SIG         (0x00001020)    // Acc interrupt signal