init

Dependencies:   aconno_I2C Lis2dh12 WatchdogTimer

Committer:
pathfindr
Date:
Thu May 23 11:39:28 2019 +0000
Revision:
51:9078e6928412
Parent:
50:a94e70c00fff
Child:
52:bd7678eade77
init

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 51:9078e6928412 19 #define FW_VERSION 20
pathfindr 48:64b1613941d5 20 //#define SKU "GPSPLUSDEV"
pathfindr 46:b95fe3484d88 21 #define SKU "GPSPLUS"
pathfindr 41:07e41dbd5304 22 #define HW_MAJORREVISION "001"
pathfindr 41:07e41dbd5304 23
pathfindr 41:07e41dbd5304 24 //MODES
pathfindr 41:07e41dbd5304 25 #define USE_NRF_TEMP_SENSOR 1
pathfindr 41:07e41dbd5304 26
pathfindr 41:07e41dbd5304 27 //DEFAULT SETTINGS
pathfindr 48:64b1613941d5 28 #define DEFAULT_SLEEP_FRAME 60000
pathfindr 50:a94e70c00fff 29 #define DEFAULT_FORCE2G false
pathfindr 48:64b1613941d5 30 #define DEFAULT_LOCATION_MODE 1
pathfindr 48:64b1613941d5 31 #define DEFAULT_LOCATION_ACCURACY 1 // 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 48:64b1613941d5 34 #define DEFAULT_LOCATION_TIMEOUT 120
pathfindr 48:64b1613941d5 35 #define DEFAULT_MOTION_G 7
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 49:15ddd84ec9fa 40 #define DEFAULT_CONNECTION_TIMEOUT 140
pathfindr 51:9078e6928412 41 #define DEFAULT_MAX_FAILED_CONNECTIONS 3 //max number of failed connections before device stops broadcasting until movement detected
pathfindr 51:9078e6928412 42 #define DEFAULT_MAX_FAILED_GPS 3 //max number of failed gps searches before device stops trying gps until movement detected
pathfindr 41:07e41dbd5304 43
pathfindr 41:07e41dbd5304 44 //CONSTS
pathfindr 41:07e41dbd5304 45 #define ONEDAYINSECONDS 86400
pathfindr 41:07e41dbd5304 46 #define THREEDAYSINSECONDS 259200
pathfindr 41:07e41dbd5304 47 #define SEVENDAYSINSECONDS 604800
pathfindr 41:07e41dbd5304 48 #define TENDAYSINSECONDS 864000
pathfindr 41:07e41dbd5304 49
pathfindr 51:9078e6928412 50 //MODES
pathfindr 51:9078e6928412 51 #define LOCATION_MODE_INTERVAL 1
pathfindr 51:9078e6928412 52 #define LOCATION_MODE_INTERVAL_MOTION 2
pathfindr 51:9078e6928412 53 #define LOCATION_MODE_INTELLIGENT 3
pathfindr 51:9078e6928412 54 #define LOCATION_MODE_REALTIME 4
pathfindr 51:9078e6928412 55
pathfindr 45:6c7f5b556d74 56 //DEFINES
pathfindr 45:6c7f5b556d74 57 #define ACTIVITY_BUFFERSIZE 100
pathfindr 45:6c7f5b556d74 58
pathfindr 41:07e41dbd5304 59 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 60 //mbed Libraries
pathfindr 0:94b743e06998 61 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 62 #include "mbed.h"
pathfindr 51:9078e6928412 63 //#include "nrf_soc.h"
pathfindr 34:4493c9f6d707 64 #include "nrf_temp.h"
pathfindr 7:e9a19750700d 65 #include "board.h"
pathfindr 24:c161db07557f 66 //#include "ble/BLE.h"
pathfindr 51:9078e6928412 67 //#include "FlashIAPBlockDevice.h"
pathfindr 0:94b743e06998 68
pathfindr 0:94b743e06998 69 //------------------------------------------------------------------------------
pathfindr 2:fd554f01abdf 70 //peripheral Libraries
pathfindr 0:94b743e06998 71 //------------------------------------------------------------------------------
pathfindr 34:4493c9f6d707 72 #include "WatchdogTimer.h"
pathfindr 0:94b743e06998 73 #include "LIS3DH.h"
pathfindr 51:9078e6928412 74 //#include "SI7060.h"
pathfindr 14:9a54b1b65bc8 75 #include "acd_nrf52_saadc.h"
pathfindr 0:94b743e06998 76
pathfindr 0:94b743e06998 77 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 78 //Application headers
pathfindr 0:94b743e06998 79 //------------------------------------------------------------------------------
pathfindr 36:8e359069192b 80 #include "NRFuart.h"
pathfindr 34:4493c9f6d707 81 #include "app_data.h"
pathfindr 16:3bf5f1a5f869 82 #include "states.h"
pathfindr 7:e9a19750700d 83 #include "common.h"
pathfindr 7:e9a19750700d 84 #include "sensors.h"
pathfindr 7:e9a19750700d 85 #include "modem.h"
pathfindr 5:8f8951127724 86
pathfindr 0:94b743e06998 87 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 88 //Global macros
pathfindr 0:94b743e06998 89 //------------------------------------------------------------------------------
pathfindr 16:3bf5f1a5f869 90 //#define lowByte(w) ((uint8_t) ((w) & 0xff))
pathfindr 16:3bf5f1a5f869 91 //#define highByte(w) ((uint8_t) ((w) >> 8))
pathfindr 0:94b743e06998 92
pathfindr 36:8e359069192b 93 //------------------------------------------------------------------------------
pathfindr 36:8e359069192b 94 //GLOBAL VARS
pathfindr 36:8e359069192b 95 //------------------------------------------------------------------------------
pathfindr 36:8e359069192b 96
pathfindr 13:29f67f256709 97 extern bool GLOBAL_accel_healthy;
pathfindr 13:29f67f256709 98 extern bool GLOBAL_requireSoftReset;
pathfindr 13:29f67f256709 99 extern bool GLOBAL_motionFlagTriggered;
pathfindr 13:29f67f256709 100 extern bool GLOBAL_debugLED;
pathfindr 13:29f67f256709 101 extern bool GLOBAL_needToConfigureLis3dh;
pathfindr 13:29f67f256709 102 extern bool GLOBAL_registeredOnNetwork;
pathfindr 22:810425eb76e1 103 extern bool GLOBAL_modemOn;
pathfindr 33:760005331b4c 104 extern bool GLOBAL_LEDSequenceinProgress;
pathfindr 13:29f67f256709 105 extern time_t GLOBAL_RTCunixtime;
pathfindr 13:29f67f256709 106 extern time_t GLOBAL_wakeTime;
pathfindr 34:4493c9f6d707 107 extern char GLOBAL_debug_buffer[200];
pathfindr 20:5404841fdd2b 108 //FUNCS
pathfindr 20:5404841fdd2b 109 extern void watchdogKick();
pathfindr 20:5404841fdd2b 110
pathfindr 16:3bf5f1a5f869 111 #endif