init
Dependencies: aconno_I2C Lis2dh12 WatchdogTimer
main.h@38:476a9b5629a1, 2019-01-16 (annotated)
- Committer:
- pathfindr
- Date:
- Wed Jan 16 23:06:39 2019 +0000
- Revision:
- 38:476a9b5629a1
- Parent:
- 36:8e359069192b
- Child:
- 41:07e41dbd5304
updates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pathfindr | 0:94b743e06998 | 1 | /* |
pathfindr | 0:94b743e06998 | 2 | ================================================================================ |
pathfindr | 21:e0b866630c27 | 3 | Project: GPS Tracker |
pathfindr | 0:94b743e06998 | 4 | Module: --- |
pathfindr | 0:94b743e06998 | 5 | Status: Development |
pathfindr | 0:94b743e06998 | 6 | Type: .h header file |
pathfindr | 0:94b743e06998 | 7 | Copyright (c) 2018 Pathfindr Ltd |
pathfindr | 0:94b743e06998 | 8 | All Rights Reserved. |
pathfindr | 0:94b743e06998 | 9 | ================================================================================ |
pathfindr | 0:94b743e06998 | 10 | Notes: |
pathfindr | 0:94b743e06998 | 11 | |
pathfindr | 0:94b743e06998 | 12 | ================================================================================ |
pathfindr | 0:94b743e06998 | 13 | */ |
pathfindr | 0:94b743e06998 | 14 | |
pathfindr | 0:94b743e06998 | 15 | #ifndef MAIN_INTERFACE_H_ |
pathfindr | 0:94b743e06998 | 16 | #define MAIN_INTERFACE_H_ |
pathfindr | 0:94b743e06998 | 17 | |
pathfindr | 0:94b743e06998 | 18 | //------------------------------------------------------------------------------ |
pathfindr | 0:94b743e06998 | 19 | //mbed Libraries |
pathfindr | 0:94b743e06998 | 20 | //------------------------------------------------------------------------------ |
pathfindr | 0:94b743e06998 | 21 | #include "mbed.h" |
pathfindr | 34:4493c9f6d707 | 22 | //#include "nrf_soc.h" |
pathfindr | 34:4493c9f6d707 | 23 | #include "nrf_temp.h" |
pathfindr | 7:e9a19750700d | 24 | #include "board.h" |
pathfindr | 24:c161db07557f | 25 | //#include "ble/BLE.h" |
pathfindr | 7:e9a19750700d | 26 | //#include "nvstore.h" |
pathfindr | 34:4493c9f6d707 | 27 | #include "FlashIAPBlockDevice.h" |
pathfindr | 34:4493c9f6d707 | 28 | //#include "nrf_drv_uart.h" |
pathfindr | 0:94b743e06998 | 29 | |
pathfindr | 0:94b743e06998 | 30 | //------------------------------------------------------------------------------ |
pathfindr | 2:fd554f01abdf | 31 | //peripheral Libraries |
pathfindr | 0:94b743e06998 | 32 | //------------------------------------------------------------------------------ |
pathfindr | 34:4493c9f6d707 | 33 | #include "WatchdogTimer.h" |
pathfindr | 0:94b743e06998 | 34 | #include "LIS3DH.h" |
pathfindr | 11:60eb0ff945f2 | 35 | #include "SI7060.h" |
pathfindr | 14:9a54b1b65bc8 | 36 | #include "acd_nrf52_saadc.h" |
pathfindr | 0:94b743e06998 | 37 | |
pathfindr | 0:94b743e06998 | 38 | //------------------------------------------------------------------------------ |
pathfindr | 0:94b743e06998 | 39 | //Application headers |
pathfindr | 0:94b743e06998 | 40 | //------------------------------------------------------------------------------ |
pathfindr | 36:8e359069192b | 41 | #include "NRFuart.h" |
pathfindr | 34:4493c9f6d707 | 42 | #include "app_data.h" |
pathfindr | 16:3bf5f1a5f869 | 43 | #include "states.h" |
pathfindr | 7:e9a19750700d | 44 | #include "common.h" |
pathfindr | 7:e9a19750700d | 45 | #include "sensors.h" |
pathfindr | 7:e9a19750700d | 46 | #include "modem.h" |
pathfindr | 5:8f8951127724 | 47 | |
pathfindr | 0:94b743e06998 | 48 | //------------------------------------------------------------------------------ |
pathfindr | 0:94b743e06998 | 49 | //Global macros |
pathfindr | 0:94b743e06998 | 50 | //------------------------------------------------------------------------------ |
pathfindr | 16:3bf5f1a5f869 | 51 | //#define lowByte(w) ((uint8_t) ((w) & 0xff)) |
pathfindr | 16:3bf5f1a5f869 | 52 | //#define highByte(w) ((uint8_t) ((w) >> 8)) |
pathfindr | 0:94b743e06998 | 53 | |
pathfindr | 34:4493c9f6d707 | 54 | #define DEBUG_ON 1 |
pathfindr | 0:94b743e06998 | 55 | |
pathfindr | 36:8e359069192b | 56 | //OLD DEBUG STUFF |
pathfindr | 36:8e359069192b | 57 | #define CONSOLE_DEBUG 0 |
pathfindr | 36:8e359069192b | 58 | #if CONSOLE_DEBUG |
pathfindr | 36:8e359069192b | 59 | #define DEBUG(str, ... ) do{\ |
pathfindr | 36:8e359069192b | 60 | /*int n;\ |
pathfindr | 36:8e359069192b | 61 | char buffer[200];\ |
pathfindr | 36:8e359069192b | 62 | memset(buffer, '\0', sizeof(buffer));\ |
pathfindr | 36:8e359069192b | 63 | n = snprintf(buffer, sizeof(buffer), str, __VA_ARGS__);\ |
pathfindr | 36:8e359069192b | 64 | buffer[sizeof(buffer)-1] = 0x00;\ |
pathfindr | 36:8e359069192b | 65 | if(n < 0) { }\ |
pathfindr | 36:8e359069192b | 66 | else if(n >= sizeof(buffer)) { }\ |
pathfindr | 36:8e359069192b | 67 | else\ |
pathfindr | 36:8e359069192b | 68 | {\ |
pathfindr | 36:8e359069192b | 69 | NRFuart_puts_debug(buffer);\ |
pathfindr | 36:8e359069192b | 70 | }\ |
pathfindr | 36:8e359069192b | 71 | }while(0)*/ |
pathfindr | 36:8e359069192b | 72 | #else |
pathfindr | 36:8e359069192b | 73 | #define DEBUG(...) |
pathfindr | 36:8e359069192b | 74 | #endif |
pathfindr | 36:8e359069192b | 75 | |
pathfindr | 0:94b743e06998 | 76 | //------------------------------------------------------------------------------ |
pathfindr | 0:94b743e06998 | 77 | //Global data structures |
pathfindr | 0:94b743e06998 | 78 | //------------------------------------------------------------------------------ |
pathfindr | 36:8e359069192b | 79 | |
pathfindr | 36:8e359069192b | 80 | //------------------------------------------------------------------------------ |
pathfindr | 36:8e359069192b | 81 | //GLOBAL VARS |
pathfindr | 36:8e359069192b | 82 | //------------------------------------------------------------------------------ |
pathfindr | 36:8e359069192b | 83 | |
pathfindr | 13:29f67f256709 | 84 | //PERFS |
pathfindr | 0:94b743e06998 | 85 | |
pathfindr | 7:e9a19750700d | 86 | //VARS |
pathfindr | 13:29f67f256709 | 87 | extern bool GLOBAL_accel_healthy; |
pathfindr | 13:29f67f256709 | 88 | extern bool GLOBAL_requireSoftReset; |
pathfindr | 13:29f67f256709 | 89 | extern bool GLOBAL_motionFlagTriggered; |
pathfindr | 13:29f67f256709 | 90 | extern bool GLOBAL_debugLED; |
pathfindr | 13:29f67f256709 | 91 | extern bool GLOBAL_needToConfigureLis3dh; |
pathfindr | 13:29f67f256709 | 92 | extern bool GLOBAL_registeredOnNetwork; |
pathfindr | 22:810425eb76e1 | 93 | extern bool GLOBAL_modemOn; |
pathfindr | 33:760005331b4c | 94 | extern bool GLOBAL_LEDSequenceinProgress; |
pathfindr | 13:29f67f256709 | 95 | extern time_t GLOBAL_RTCunixtime; |
pathfindr | 13:29f67f256709 | 96 | extern time_t GLOBAL_wakeTime; |
pathfindr | 34:4493c9f6d707 | 97 | extern char GLOBAL_debug_buffer[200]; |
pathfindr | 38:476a9b5629a1 | 98 | extern bool RET_force2G; |
pathfindr | 20:5404841fdd2b | 99 | //FUNCS |
pathfindr | 20:5404841fdd2b | 100 | extern void watchdogKick(); |
pathfindr | 20:5404841fdd2b | 101 | |
pathfindr | 16:3bf5f1a5f869 | 102 | #endif |