Lizzy project
Dependencies: aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT
source/main.h@15:c0c01188a29b, 2018-08-29 (annotated)
- Committer:
- dbartolovic
- Date:
- Wed Aug 29 14:48:43 2018 +0000
- Branch:
- axis_normal
- Revision:
- 15:c0c01188a29b
- Parent:
- 8:7ba4f82de9b6
- Child:
- 16:482d8f81d6f3
Brought consumption to 500uA
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jurica238814 | 0:fc77522f4d28 | 1 | /* |
jurica238814 | 0:fc77522f4d28 | 2 | * Made by Jurica Resetar @ aconno |
jurica238814 | 0:fc77522f4d28 | 3 | * More info @ aconno.de |
jurica238814 | 0:fc77522f4d28 | 4 | * |
jurica238814 | 0:fc77522f4d28 | 5 | */ |
jurica238814 | 0:fc77522f4d28 | 6 | |
jurica238814 | 0:fc77522f4d28 | 7 | #ifndef MAIN_H |
jurica238814 | 0:fc77522f4d28 | 8 | #define MAIN_H |
jurica238814 | 0:fc77522f4d28 | 9 | |
jurica238814 | 0:fc77522f4d28 | 10 | #include "mbed.h" |
jurica238814 | 0:fc77522f4d28 | 11 | #include "Lis2dh12.h" |
jurica238814 | 0:fc77522f4d28 | 12 | #include "Lis2dh12_regs.h" |
jurica238814 | 0:fc77522f4d28 | 13 | #include "aconno_ble.h" |
jurica238814 | 0:fc77522f4d28 | 14 | #include "ble/BLE.h" |
jurica238814 | 0:fc77522f4d28 | 15 | #include "GapAdvertisingData.h" |
dbartolovic | 6:55607d577a42 | 16 | #include "acd52832_bsp.h" |
jurica238814 | 0:fc77522f4d28 | 17 | |
jurica238814 | 0:fc77522f4d28 | 18 | #define DEBUG (0) |
dbartolovic | 8:7ba4f82de9b6 | 19 | #define PRINT_ON_RTT (0) |
dbartolovic | 6:55607d577a42 | 20 | #define DEBUG_LED (0) |
jurica238814 | 0:fc77522f4d28 | 21 | #define NANO_MODULE (0) |
dbartolovic | 15:c0c01188a29b | 22 | #define NORMAL_AXIS (1) |
dbartolovic | 3:38eadab20283 | 23 | //#define LSB_VALUE (192) |
jurica238814 | 0:fc77522f4d28 | 24 | |
jurica238814 | 0:fc77522f4d28 | 25 | #define BLE_ACTIVE_TIME_S (0.4) |
jurica238814 | 0:fc77522f4d28 | 26 | #define POWER_UP_DELAY_MS (200) |
jurica238814 | 0:fc77522f4d28 | 27 | |
dbartolovic | 6:55607d577a42 | 28 | |
jurica238814 | 0:fc77522f4d28 | 29 | #if PRINT_ON_RTT |
jurica238814 | 0:fc77522f4d28 | 30 | #include "SEGGER_RTT.h" |
jurica238814 | 0:fc77522f4d28 | 31 | #define printf(...) SEGGER_RTT_printf(0, __VA_ARGS__) |
jurica238814 | 0:fc77522f4d28 | 32 | #else |
jurica238814 | 0:fc77522f4d28 | 33 | #define printf(...) |
jurica238814 | 0:fc77522f4d28 | 34 | #endif |
jurica238814 | 0:fc77522f4d28 | 35 | |
jurica238814 | 0:fc77522f4d28 | 36 | #define INT1_THRESHOLD (20u) |
jurica238814 | 0:fc77522f4d28 | 37 | #define INT1_DUR (0x00) |
jurica238814 | 0:fc77522f4d28 | 38 | |
jurica238814 | 0:fc77522f4d28 | 39 | #define ACC_INT_SIG (0x00001020) // Acc interrupt signal |
jurica238814 | 0:fc77522f4d28 | 40 | #define DISABLE_BLE_SIG (0x00001030) |
jurica238814 | 0:fc77522f4d28 | 41 | |
jurica238814 | 0:fc77522f4d28 | 42 | #if DEBUG |
jurica238814 | 0:fc77522f4d28 | 43 | NRF52_UART uart(p12, p14, Baud9600); |
jurica238814 | 0:fc77522f4d28 | 44 | char buffer[255]; |
jurica238814 | 0:fc77522f4d28 | 45 | #define SEND(...) {uint8_t len = sprintf(buffer, __VA_ARGS__); uartM.lock(); uart.send(buffer, len); uartM.unlock();} |
jurica238814 | 0:fc77522f4d28 | 46 | #else |
jurica238814 | 0:fc77522f4d28 | 47 | #define SEND(...) |
jurica238814 | 0:fc77522f4d28 | 48 | #endif |
jurica238814 | 0:fc77522f4d28 | 49 | |
jurica238814 | 0:fc77522f4d28 | 50 | |
dbartolovic | 8:7ba4f82de9b6 | 51 | extern Thread bleT; |
dbartolovic | 8:7ba4f82de9b6 | 52 | extern Thread measureT; |
dbartolovic | 8:7ba4f82de9b6 | 53 | extern Thread updateServiceT; |
dbartolovic | 8:7ba4f82de9b6 | 54 | extern Thread updateBuzzLedsT; |
jurica238814 | 0:fc77522f4d28 | 55 | |
dbartolovic | 15:c0c01188a29b | 56 | void disableI2C(); |
dbartolovic | 15:c0c01188a29b | 57 | |
jurica238814 | 0:fc77522f4d28 | 58 | #endif |