Lizzy project

Dependencies:   aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT

Branch:
testing-ignore
Revision:
24:7539258b015c
Parent:
23:bf9c1dd2b5cb
Child:
26:6101bb09f70d
diff -r bf9c1dd2b5cb -r 7539258b015c source/main.cpp
--- a/source/main.cpp	Mon Sep 17 12:46:41 2018 +0000
+++ b/source/main.cpp	Thu Sep 20 07:34:35 2018 +0000
@@ -17,6 +17,8 @@
 Thread updateBuzzLedsT;
 Thread servLoopT;
 
+
+extern DigitalOut redLed;
 DigitalOut AccVcc(ACC_POWER_PIN);
 InterruptIn INT1(INT_PIN1);
 //InterruptIn INT2(INT_PIN2);
@@ -24,31 +26,13 @@
 
 Lis2dh12 mems(&i2c, memsI2CAddress);
 
-void disableI2C(){
-    NRF_TWI0->ENABLE = 0;
-    NRF_TWI0->PSELSCL = 0xFFFFFFFF;
-    NRF_TWI1->ENABLE = 0;
-    NRF_TWI1->PSELSCL = 0xFFFFFFFF;
-    NRF_TWIM0->ENABLE = 0;
-    NRF_TWIM0->PSEL.SCL = 0x80000000;
-    NRF_TWIM0->PSEL.SDA = 0x80000000;
-    NRF_TWIM1->ENABLE = 0;
-    NRF_TWIM0->PSEL.SCL = 0x80000000;
-    NRF_TWIM0->PSEL.SDA = 0x80000000;
-    DigitalOut foo(I2C_DATA);
-    DigitalOut bar(I2C_CLK);
-    foo = 1;
-    bar = 1;
-}
 
-extern int untilSleep;
 void int1Handler(void)
 {
     __disable_irq();
     
     mems.clearIntFlag();
-    
-    untilSleep = ACTIVE_PERIOD / MEASURE_INTERVAL_MS;
+    //redLed = !redLed;
     
     measureT.signal_set(START_MEAS);
     
@@ -66,16 +50,14 @@
     NRF_NVMC->CONFIG = 0x00000001;      // Write enable UICR
     NRF_UICR->NFCPINS = 0xFFFFFFFE;     // Change NFC to GPIO function
     
+
     AccVcc = 1;
-    //wait_ms(POWER_UP_DELAY_MS);
-    Thread::wait(POWER_UP_DELAY_MS);
+    wait_ms(POWER_UP_DELAY_MS);
 
-    
     //measureT.signal_set(START_MEAS);
     INT1.rise(int1Handler);
     NRF_GPIO->PIN_CNF[INT_PIN1] &= 0xFFFFFFF3;  // NO PullUps
     
-    
     BLE &ble = BLE::Instance();
     ble.init(bleInitComplete);
 
@@ -84,7 +66,7 @@
     mems.enableAxes(X_axis);
     mems.enableAxes(Y_axis);
     mems.enableAxes(Z_axis);    
-    mems.setODR(ACC_ODR_SLEEP_MODE);
+    mems.setODR(ACC_ODR_MODE);
     //mems.setScale(_16g);
     mems.setScale(_8g);
     mems.int1Setup(0x40);       // IntActivity 1 driven to INT1 pad
@@ -99,7 +81,6 @@
     updateBuzzLedsT.start(updateBuzzLedsF);
     servLoopT.start(servLoopC);
     
-    
     while(1){
         //disableI2C();
         //ble.waitForEvent();