Indoor positioning. Central unit.
Dependencies: aconno_SEGGER_RTT
source/main.cpp@2:1b85a28b1e68, 2018-03-07 (annotated)
- Committer:
- dbartolovic
- Date:
- Wed Mar 07 11:43:39 2018 +0000
- Revision:
- 2:1b85a28b1e68
- Parent:
- 1:2bdc506d8baa
Central module now sends messages as soon as it receives them.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jurica238814 | 0:07a75b2fae14 | 1 | /* |
jurica238814 | 0:07a75b2fae14 | 2 | * |
jurica238814 | 0:07a75b2fae14 | 3 | * |
jurica238814 | 0:07a75b2fae14 | 4 | */ |
jurica238814 | 0:07a75b2fae14 | 5 | |
jurica238814 | 0:07a75b2fae14 | 6 | #include "main.h" |
jurica238814 | 0:07a75b2fae14 | 7 | |
dbartolovic | 2:1b85a28b1e68 | 8 | |
dbartolovic | 2:1b85a28b1e68 | 9 | #if DEBUG_LED |
dbartolovic | 2:1b85a28b1e68 | 10 | DigitalOut advLed(p22); |
dbartolovic | 2:1b85a28b1e68 | 11 | DigitalOut scanLed(p23); |
dbartolovic | 2:1b85a28b1e68 | 12 | DigitalOut periodicLed(p24); |
dbartolovic | 2:1b85a28b1e68 | 13 | #endif |
dbartolovic | 2:1b85a28b1e68 | 14 | |
dbartolovic | 2:1b85a28b1e68 | 15 | Thread tBleUpdateData; |
dbartolovic | 2:1b85a28b1e68 | 16 | Thread tBleStartAdvertising; |
dbartolovic | 2:1b85a28b1e68 | 17 | Thread tBleStartScanning; |
dbartolovic | 2:1b85a28b1e68 | 18 | Thread tPeriodicCallback; |
dbartolovic | 2:1b85a28b1e68 | 19 | |
jurica238814 | 0:07a75b2fae14 | 20 | int main() |
jurica238814 | 0:07a75b2fae14 | 21 | { |
jurica238814 | 0:07a75b2fae14 | 22 | printf("Main program started.\r\n"); |
jurica238814 | 0:07a75b2fae14 | 23 | |
jurica238814 | 0:07a75b2fae14 | 24 | BLE &ble = BLE::Instance(); |
jurica238814 | 0:07a75b2fae14 | 25 | ble.init(bleInitComplete); |
jurica238814 | 0:07a75b2fae14 | 26 | printf("BLE initialised.\r\n"); |
jurica238814 | 0:07a75b2fae14 | 27 | |
jurica238814 | 0:07a75b2fae14 | 28 | #if DEBUG_LED |
jurica238814 | 0:07a75b2fae14 | 29 | // Turn the leds off |
jurica238814 | 0:07a75b2fae14 | 30 | advLed = 1; |
jurica238814 | 0:07a75b2fae14 | 31 | scanLed = 1; |
jurica238814 | 0:07a75b2fae14 | 32 | periodicLed = 1; |
jurica238814 | 0:07a75b2fae14 | 33 | #endif |
jurica238814 | 0:07a75b2fae14 | 34 | |
dbartolovic | 2:1b85a28b1e68 | 35 | tBleUpdateData.start(callback(bleUpdateData, &ble)); |
dbartolovic | 1:2bdc506d8baa | 36 | tBleStartAdvertising.start(callback(bleStartAdvertising, &ble)); |
jurica238814 | 0:07a75b2fae14 | 37 | tBleStartScanning.start(callback(bleStartScanning, &ble)); |
jurica238814 | 0:07a75b2fae14 | 38 | tPeriodicCallback.start(callback(periodicCallback, &ble)); |
jurica238814 | 0:07a75b2fae14 | 39 | |
jurica238814 | 0:07a75b2fae14 | 40 | while(true) |
jurica238814 | 0:07a75b2fae14 | 41 | { |
jurica238814 | 0:07a75b2fae14 | 42 | // Do nothing |
jurica238814 | 0:07a75b2fae14 | 43 | |
jurica238814 | 0:07a75b2fae14 | 44 | } |
jurica238814 | 0:07a75b2fae14 | 45 | } |
jurica238814 | 0:07a75b2fae14 | 46 |