init

Dependencies:   aconno_I2C Lis2dh12 WatchdogTimer

Committer:
pathfindr
Date:
Sun Jan 20 00:15:03 2019 +0000
Revision:
43:7b232f03628f
Parent:
41:07e41dbd5304
Child:
44:061509d1b38c
performance tweaks

Who changed what in which revision?

UserRevisionLine numberNew 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 #ifndef MAIN_INTERFACE_H_
pathfindr 0:94b743e06998 14 #define MAIN_INTERFACE_H_
pathfindr 0:94b743e06998 15
pathfindr 0:94b743e06998 16 //------------------------------------------------------------------------------
pathfindr 41:07e41dbd5304 17 //DEFINES
pathfindr 41:07e41dbd5304 18 //------------------------------------------------------------------------------
pathfindr 43:7b232f03628f 19 #define FW_VERSION 1
pathfindr 43:7b232f03628f 20 #define SKU "GPSP"
pathfindr 41:07e41dbd5304 21 #define HW_MAJORREVISION "001"
pathfindr 41:07e41dbd5304 22
pathfindr 41:07e41dbd5304 23 //MODES
pathfindr 41:07e41dbd5304 24 #define USE_NRF_TEMP_SENSOR 1
pathfindr 41:07e41dbd5304 25 #define DEBUG_ON 1
pathfindr 41:07e41dbd5304 26
pathfindr 41:07e41dbd5304 27 //DEFAULT SETTINGS
pathfindr 43:7b232f03628f 28 #define DEFAULT_SLEEP_FRAME 30000
pathfindr 41:07e41dbd5304 29 #define DEFAULT_FORCE2G true
pathfindr 41:07e41dbd5304 30 #define DEFAULT_LOCATION_MODE 2
pathfindr 41:07e41dbd5304 31 #define DEFAULT_LOCATION_ACCURACY 2 // 0 = no location, 1 = cl only, 2 = gps then cl
pathfindr 41:07e41dbd5304 32 #define DEFAULT_LOCATION_TX_INTERVAL_MINS 1440
pathfindr 41:07e41dbd5304 33 #define DEFAULT_LOCATION_TX_FAILSAFE_HRS 168
pathfindr 41:07e41dbd5304 34 #define DEFAULT_LOCATION_TIMEOUT 180
pathfindr 41:07e41dbd5304 35 #define DEFAULT_MOTION_G 11
pathfindr 41:07e41dbd5304 36 #define DEFAULT_MOTION_START_SECONDS 120
pathfindr 41:07e41dbd5304 37 #define DEFAULT_MOTION_STOP_SECONDS 120
pathfindr 41:07e41dbd5304 38 #define DEFAULT_IMPACT_G 127
pathfindr 41:07e41dbd5304 39 #define DEFAULT_CONNECTION_ATTEMPTS 1
pathfindr 41:07e41dbd5304 40 #define DEFAULT_CONNECTION_TIMEOUT 180
pathfindr 41:07e41dbd5304 41 #define DEFAULT_BEACON_INTERVAL_SECONDS 10
pathfindr 41:07e41dbd5304 42
pathfindr 41:07e41dbd5304 43 //CONSTS
pathfindr 41:07e41dbd5304 44 #define ONEDAYINSECONDS 86400
pathfindr 41:07e41dbd5304 45 #define THREEDAYSINSECONDS 259200
pathfindr 41:07e41dbd5304 46 #define SEVENDAYSINSECONDS 604800
pathfindr 41:07e41dbd5304 47 #define TENDAYSINSECONDS 864000
pathfindr 41:07e41dbd5304 48
pathfindr 41:07e41dbd5304 49 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 50 //mbed Libraries
pathfindr 0:94b743e06998 51 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 52 #include "mbed.h"
pathfindr 34:4493c9f6d707 53 //#include "nrf_soc.h"
pathfindr 34:4493c9f6d707 54 #include "nrf_temp.h"
pathfindr 7:e9a19750700d 55 #include "board.h"
pathfindr 24:c161db07557f 56 //#include "ble/BLE.h"
pathfindr 7:e9a19750700d 57 //#include "nvstore.h"
pathfindr 34:4493c9f6d707 58 #include "FlashIAPBlockDevice.h"
pathfindr 0:94b743e06998 59
pathfindr 0:94b743e06998 60 //------------------------------------------------------------------------------
pathfindr 2:fd554f01abdf 61 //peripheral Libraries
pathfindr 0:94b743e06998 62 //------------------------------------------------------------------------------
pathfindr 34:4493c9f6d707 63 #include "WatchdogTimer.h"
pathfindr 0:94b743e06998 64 #include "LIS3DH.h"
pathfindr 11:60eb0ff945f2 65 #include "SI7060.h"
pathfindr 14:9a54b1b65bc8 66 #include "acd_nrf52_saadc.h"
pathfindr 0:94b743e06998 67
pathfindr 0:94b743e06998 68 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 69 //Application headers
pathfindr 0:94b743e06998 70 //------------------------------------------------------------------------------
pathfindr 36:8e359069192b 71 #include "NRFuart.h"
pathfindr 34:4493c9f6d707 72 #include "app_data.h"
pathfindr 16:3bf5f1a5f869 73 #include "states.h"
pathfindr 7:e9a19750700d 74 #include "common.h"
pathfindr 7:e9a19750700d 75 #include "sensors.h"
pathfindr 7:e9a19750700d 76 #include "modem.h"
pathfindr 5:8f8951127724 77
pathfindr 0:94b743e06998 78 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 79 //Global macros
pathfindr 0:94b743e06998 80 //------------------------------------------------------------------------------
pathfindr 16:3bf5f1a5f869 81 //#define lowByte(w) ((uint8_t) ((w) & 0xff))
pathfindr 16:3bf5f1a5f869 82 //#define highByte(w) ((uint8_t) ((w) >> 8))
pathfindr 0:94b743e06998 83
pathfindr 36:8e359069192b 84
pathfindr 36:8e359069192b 85 //------------------------------------------------------------------------------
pathfindr 36:8e359069192b 86 //GLOBAL VARS
pathfindr 36:8e359069192b 87 //------------------------------------------------------------------------------
pathfindr 36:8e359069192b 88
pathfindr 13:29f67f256709 89 extern bool GLOBAL_accel_healthy;
pathfindr 13:29f67f256709 90 extern bool GLOBAL_requireSoftReset;
pathfindr 13:29f67f256709 91 extern bool GLOBAL_motionFlagTriggered;
pathfindr 13:29f67f256709 92 extern bool GLOBAL_debugLED;
pathfindr 13:29f67f256709 93 extern bool GLOBAL_needToConfigureLis3dh;
pathfindr 13:29f67f256709 94 extern bool GLOBAL_registeredOnNetwork;
pathfindr 22:810425eb76e1 95 extern bool GLOBAL_modemOn;
pathfindr 33:760005331b4c 96 extern bool GLOBAL_LEDSequenceinProgress;
pathfindr 13:29f67f256709 97 extern time_t GLOBAL_RTCunixtime;
pathfindr 13:29f67f256709 98 extern time_t GLOBAL_wakeTime;
pathfindr 34:4493c9f6d707 99 extern char GLOBAL_debug_buffer[200];
pathfindr 38:476a9b5629a1 100 extern bool RET_force2G;
pathfindr 20:5404841fdd2b 101 //FUNCS
pathfindr 20:5404841fdd2b 102 extern void watchdogKick();
pathfindr 20:5404841fdd2b 103
pathfindr 16:3bf5f1a5f869 104 #endif