init

Dependencies:   aconno_I2C Lis2dh12 WatchdogTimer

Committer:
pathfindr
Date:
Sun Jan 20 21:40:53 2019 +0000
Revision:
45:6c7f5b556d74
Parent:
44:061509d1b38c
Child:
46:b95fe3484d88
added total runtime hours and activity mode

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 45:6c7f5b556d74 19 #define FW_VERSION 8
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 45:6c7f5b556d74 49 //DEFINES
pathfindr 45:6c7f5b556d74 50 #define ACTIVITY_BUFFERSIZE 100
pathfindr 45:6c7f5b556d74 51
pathfindr 41:07e41dbd5304 52 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 53 //mbed Libraries
pathfindr 0:94b743e06998 54 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 55 #include "mbed.h"
pathfindr 34:4493c9f6d707 56 //#include "nrf_soc.h"
pathfindr 34:4493c9f6d707 57 #include "nrf_temp.h"
pathfindr 7:e9a19750700d 58 #include "board.h"
pathfindr 24:c161db07557f 59 //#include "ble/BLE.h"
pathfindr 7:e9a19750700d 60 //#include "nvstore.h"
pathfindr 34:4493c9f6d707 61 #include "FlashIAPBlockDevice.h"
pathfindr 0:94b743e06998 62
pathfindr 0:94b743e06998 63 //------------------------------------------------------------------------------
pathfindr 2:fd554f01abdf 64 //peripheral Libraries
pathfindr 0:94b743e06998 65 //------------------------------------------------------------------------------
pathfindr 34:4493c9f6d707 66 #include "WatchdogTimer.h"
pathfindr 0:94b743e06998 67 #include "LIS3DH.h"
pathfindr 11:60eb0ff945f2 68 #include "SI7060.h"
pathfindr 14:9a54b1b65bc8 69 #include "acd_nrf52_saadc.h"
pathfindr 0:94b743e06998 70
pathfindr 0:94b743e06998 71 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 72 //Application headers
pathfindr 0:94b743e06998 73 //------------------------------------------------------------------------------
pathfindr 36:8e359069192b 74 #include "NRFuart.h"
pathfindr 34:4493c9f6d707 75 #include "app_data.h"
pathfindr 16:3bf5f1a5f869 76 #include "states.h"
pathfindr 7:e9a19750700d 77 #include "common.h"
pathfindr 7:e9a19750700d 78 #include "sensors.h"
pathfindr 7:e9a19750700d 79 #include "modem.h"
pathfindr 5:8f8951127724 80
pathfindr 0:94b743e06998 81 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 82 //Global macros
pathfindr 0:94b743e06998 83 //------------------------------------------------------------------------------
pathfindr 16:3bf5f1a5f869 84 //#define lowByte(w) ((uint8_t) ((w) & 0xff))
pathfindr 16:3bf5f1a5f869 85 //#define highByte(w) ((uint8_t) ((w) >> 8))
pathfindr 0:94b743e06998 86
pathfindr 36:8e359069192b 87
pathfindr 36:8e359069192b 88 //------------------------------------------------------------------------------
pathfindr 36:8e359069192b 89 //GLOBAL VARS
pathfindr 36:8e359069192b 90 //------------------------------------------------------------------------------
pathfindr 36:8e359069192b 91
pathfindr 13:29f67f256709 92 extern bool GLOBAL_accel_healthy;
pathfindr 13:29f67f256709 93 extern bool GLOBAL_requireSoftReset;
pathfindr 13:29f67f256709 94 extern bool GLOBAL_motionFlagTriggered;
pathfindr 13:29f67f256709 95 extern bool GLOBAL_debugLED;
pathfindr 13:29f67f256709 96 extern bool GLOBAL_needToConfigureLis3dh;
pathfindr 13:29f67f256709 97 extern bool GLOBAL_registeredOnNetwork;
pathfindr 22:810425eb76e1 98 extern bool GLOBAL_modemOn;
pathfindr 33:760005331b4c 99 extern bool GLOBAL_LEDSequenceinProgress;
pathfindr 13:29f67f256709 100 extern time_t GLOBAL_RTCunixtime;
pathfindr 13:29f67f256709 101 extern time_t GLOBAL_wakeTime;
pathfindr 34:4493c9f6d707 102 extern char GLOBAL_debug_buffer[200];
pathfindr 38:476a9b5629a1 103 extern bool RET_force2G;
pathfindr 20:5404841fdd2b 104 //FUNCS
pathfindr 20:5404841fdd2b 105 extern void watchdogKick();
pathfindr 20:5404841fdd2b 106
pathfindr 16:3bf5f1a5f869 107 #endif