Lizzy project
Dependencies: aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT
Diff: source/main.cpp
- Branch:
- axis_normal
- Revision:
- 15:c0c01188a29b
- Parent:
- 14:65734075c8d3
- Child:
- 16:482d8f81d6f3
--- a/source/main.cpp Wed Aug 29 10:52:27 2018 +0000 +++ b/source/main.cpp Wed Aug 29 14:48:43 2018 +0000 @@ -18,6 +18,7 @@ Thread updateServiceT; Thread updateBuzzLedsT; +DigitalOut redica(PIN_LED_RED); DigitalOut AccVcc(ACC_POWER_PIN); InterruptIn INT1(INT_PIN1); //InterruptIn INT2(INT_PIN2); @@ -42,9 +43,21 @@ bar = 1; } +extern int untilSleep; +void int1Handler(void) +{ + untilSleep = ACTIVE_PERIOD / MEASURE_INTERVAL_MS; + + redica = !redica; + + measureT.signal_set(START_MEAS); +} + int main(){ Lis2dh12 mems(&i2c, memsI2CAddress); + redica = 1; + tasks_init(); printf("Main program started.\r\n"); @@ -57,10 +70,10 @@ AccVcc = 1; wait_ms(POWER_UP_DELAY_MS); - /* + INT1.rise(int1Handler); NRF_GPIO->PIN_CNF[INT_PIN1] &= 0xFFFFFFF3; // NO PullUps - */ + BLE &ble = BLE::Instance(); ble.init(bleInitComplete); @@ -87,6 +100,8 @@ while(1){ //disableI2C(); - ble.waitForEvent(); + //ble.waitForEvent(); + getBLEEventQueue()->dispatch_forever(); + Thread::wait(0xFFFFFFFF); } }