Lizzy project

Dependencies:   aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT

Branch:
SimpleGATTExample
Revision:
22:7dae8496b97c
Parent:
19:2681edc2f2b9
--- a/source/main.cpp	Thu Sep 13 12:20:35 2018 +0200
+++ b/source/main.cpp	Thu Sep 13 15:14:14 2018 +0200
@@ -12,36 +12,18 @@
 #include "aconnoConfig.h"
 #include "aconno_ble.h"
 
-#if !defined(MBED_CPU_STATS_ENABLED) || !defined(DEVICE_LPTICKER) || !defined(DEVICE_SLEEP)
+#if !defined(MBED_CPU_STATS_ENABLED) || !defined(DEVICE_LPTICKER) || \
+	!defined(DEVICE_SLEEP)
 #error [NOT_SUPPORTED] Test not supported for statistics
 #endif
 
 EventQueue queue(32 * EVENTS_EVENT_SIZE);
 
-Thread uartT;
 Thread bleT;
-Thread measureT;
 Thread updateServiceT;
 Thread updateBuzzLedsT;
 Thread updateStatisticsT;
 
-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;
-}
-
 void printStatsF()
 {
     mbed_stats_cpu_t stats;
@@ -58,76 +40,20 @@
     queue.call(Callback<void()>(&ble, &BLE::processEvents));
 }
 
-Thread testThread;
-
-void testFunction()
-{
-	while(1)
-	{
-		printf("Test thread\n");
-		Thread::wait(1000);
-	}
-}
-
-void int1Handler(void)
-{
-    __disable_irq();
-	/*
-    untilSleep = ACTIVE_PERIOD / MEASURE_INTERVAL_MS;
-    measureT.signal_set(START_MEAS);
-	*/
-	mems.clearIntFlag();
-	redLed = !redLed;
-    __enable_irq();
-}
-
 int main()
 {
-
 	printf("Main program started.\r\n");
-
-	bspLedInit();
-
-    Lis2dh12 mems(&i2c, memsI2CAddress);
+	bspInit();
 
-    lisPowerCtrl((lisPower_t)LIS_ON);
-    wait_ms(POWER_UP_DELAY_MS);
-
-
-    lisInt1Pin.rise(int1Handler);
-    NRF_GPIO->PIN_CNF[INT_PIN1] &= 0xFFFFFFF3;  // NO PullUps
-
-	/*
     BLE &ble = BLE::Instance();
 	ble.onEventsToProcess(bleEventsProcessing);
     ble.init(bleInitComplete);
-	*/
-
-    //mems.setMode(LOW_POWER);
-    mems.setMode(HIGH_RES);
-    mems.enableAxes(X_axis);
-    mems.enableAxes(Y_axis);
-    mems.enableAxes(Z_axis);
-    mems.setODR(ODR_50Hz);
-    //mems.setScale(_16g);
-    mems.setScale(_2g);
-    mems.int1Setup(0x40);       // IntActivity 1 driven to INT1 pad
-    mems.int1Latch(0x01);       // Enable int1 latch
-    mems.int1Threshold(INT1_THRESHOLD);
-    mems.int1Duration(INT1_DUR);
-    mems.int1Config(0x2A);      // Enable XHigh, YHigh and ZHigh
-	//lisPowerCtrl(LIS_OFF);
-
-	//disableI2C();		// THIS REALLY NEEDS TO BE HERE!
 
 	#if PRINT_ON_RTT
 		queue.call_every(2000, printStatsF);
 	#endif
-	//testThread.start(testFunction);
-    //measureT.start(callback(measureF, &mems));
-    //updateServiceT.start(updateServiceF);
-    //updateBuzzLedsT.start(updateBuzzLedsF);
 
+    updateBuzzLedsT.start(updateBuzzLedsF);
 	queue.dispatch_forever();
 
 }