init

Dependencies:   aconno_I2C Lis2dh12 WatchdogTimer

Committer:
pathfindr
Date:
Tue Feb 05 14:30:57 2019 +0000
Revision:
48:64b1613941d5
Parent:
47:cc6d4d0bf897
Child:
49:15ddd84ec9fa
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 48:64b1613941d5 19 #define FW_VERSION 4
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 #define DEBUG_ON 1
pathfindr 41:07e41dbd5304 27
pathfindr 41:07e41dbd5304 28 //DEFAULT SETTINGS
pathfindr 48:64b1613941d5 29 #define DEFAULT_SLEEP_FRAME 60000
pathfindr 41:07e41dbd5304 30 #define DEFAULT_FORCE2G true
pathfindr 48:64b1613941d5 31 #define DEFAULT_LOCATION_MODE 1
pathfindr 48:64b1613941d5 32 #define DEFAULT_LOCATION_ACCURACY 1 // 0 = no location, 1 = cl only, 2 = gps then cl
pathfindr 41:07e41dbd5304 33 #define DEFAULT_LOCATION_TX_INTERVAL_MINS 1440
pathfindr 41:07e41dbd5304 34 #define DEFAULT_LOCATION_TX_FAILSAFE_HRS 168
pathfindr 48:64b1613941d5 35 #define DEFAULT_LOCATION_TIMEOUT 120
pathfindr 48:64b1613941d5 36 #define DEFAULT_MOTION_G 7
pathfindr 41:07e41dbd5304 37 #define DEFAULT_MOTION_START_SECONDS 120
pathfindr 41:07e41dbd5304 38 #define DEFAULT_MOTION_STOP_SECONDS 120
pathfindr 41:07e41dbd5304 39 #define DEFAULT_IMPACT_G 127
pathfindr 41:07e41dbd5304 40 #define DEFAULT_CONNECTION_ATTEMPTS 1
pathfindr 48:64b1613941d5 41 #define DEFAULT_CONNECTION_TIMEOUT 120
pathfindr 46:b95fe3484d88 42 #define DEFAULT_BEACON_INTERVAL_SECONDS 20
pathfindr 48:64b1613941d5 43 #define DEFAULT_MAX_FAILED_CONNECTIONS 2 //max number of failed connections before device stops broadcasting until movement detected
pathfindr 48:64b1613941d5 44 #define DEFAULT_MAX_FAILED_GPS 2 //max number of failed gps searches before device stops trying gps until movement detected
pathfindr 41:07e41dbd5304 45
pathfindr 41:07e41dbd5304 46 //CONSTS
pathfindr 41:07e41dbd5304 47 #define ONEDAYINSECONDS 86400
pathfindr 41:07e41dbd5304 48 #define THREEDAYSINSECONDS 259200
pathfindr 41:07e41dbd5304 49 #define SEVENDAYSINSECONDS 604800
pathfindr 41:07e41dbd5304 50 #define TENDAYSINSECONDS 864000
pathfindr 41:07e41dbd5304 51
pathfindr 45:6c7f5b556d74 52 //DEFINES
pathfindr 45:6c7f5b556d74 53 #define ACTIVITY_BUFFERSIZE 100
pathfindr 45:6c7f5b556d74 54
pathfindr 41:07e41dbd5304 55 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 56 //mbed Libraries
pathfindr 0:94b743e06998 57 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 58 #include "mbed.h"
pathfindr 34:4493c9f6d707 59 //#include "nrf_soc.h"
pathfindr 34:4493c9f6d707 60 #include "nrf_temp.h"
pathfindr 7:e9a19750700d 61 #include "board.h"
pathfindr 24:c161db07557f 62 //#include "ble/BLE.h"
pathfindr 7:e9a19750700d 63 //#include "nvstore.h"
pathfindr 34:4493c9f6d707 64 #include "FlashIAPBlockDevice.h"
pathfindr 0:94b743e06998 65
pathfindr 0:94b743e06998 66 //------------------------------------------------------------------------------
pathfindr 2:fd554f01abdf 67 //peripheral Libraries
pathfindr 0:94b743e06998 68 //------------------------------------------------------------------------------
pathfindr 34:4493c9f6d707 69 #include "WatchdogTimer.h"
pathfindr 0:94b743e06998 70 #include "LIS3DH.h"
pathfindr 11:60eb0ff945f2 71 #include "SI7060.h"
pathfindr 14:9a54b1b65bc8 72 #include "acd_nrf52_saadc.h"
pathfindr 0:94b743e06998 73
pathfindr 0:94b743e06998 74 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 75 //Application headers
pathfindr 0:94b743e06998 76 //------------------------------------------------------------------------------
pathfindr 36:8e359069192b 77 #include "NRFuart.h"
pathfindr 34:4493c9f6d707 78 #include "app_data.h"
pathfindr 16:3bf5f1a5f869 79 #include "states.h"
pathfindr 7:e9a19750700d 80 #include "common.h"
pathfindr 7:e9a19750700d 81 #include "sensors.h"
pathfindr 7:e9a19750700d 82 #include "modem.h"
pathfindr 5:8f8951127724 83
pathfindr 0:94b743e06998 84 //------------------------------------------------------------------------------
pathfindr 0:94b743e06998 85 //Global macros
pathfindr 0:94b743e06998 86 //------------------------------------------------------------------------------
pathfindr 16:3bf5f1a5f869 87 //#define lowByte(w) ((uint8_t) ((w) & 0xff))
pathfindr 16:3bf5f1a5f869 88 //#define highByte(w) ((uint8_t) ((w) >> 8))
pathfindr 0:94b743e06998 89
pathfindr 36:8e359069192b 90 //------------------------------------------------------------------------------
pathfindr 36:8e359069192b 91 //GLOBAL VARS
pathfindr 36:8e359069192b 92 //------------------------------------------------------------------------------
pathfindr 36:8e359069192b 93
pathfindr 13:29f67f256709 94 extern bool GLOBAL_accel_healthy;
pathfindr 13:29f67f256709 95 extern bool GLOBAL_requireSoftReset;
pathfindr 13:29f67f256709 96 extern bool GLOBAL_motionFlagTriggered;
pathfindr 13:29f67f256709 97 extern bool GLOBAL_debugLED;
pathfindr 13:29f67f256709 98 extern bool GLOBAL_needToConfigureLis3dh;
pathfindr 13:29f67f256709 99 extern bool GLOBAL_registeredOnNetwork;
pathfindr 22:810425eb76e1 100 extern bool GLOBAL_modemOn;
pathfindr 33:760005331b4c 101 extern bool GLOBAL_LEDSequenceinProgress;
pathfindr 13:29f67f256709 102 extern time_t GLOBAL_RTCunixtime;
pathfindr 13:29f67f256709 103 extern time_t GLOBAL_wakeTime;
pathfindr 34:4493c9f6d707 104 extern char GLOBAL_debug_buffer[200];
pathfindr 48:64b1613941d5 105 extern uint8_t RTCtick_ledflash_count;
pathfindr 20:5404841fdd2b 106 //FUNCS
pathfindr 20:5404841fdd2b 107 extern void watchdogKick();
pathfindr 20:5404841fdd2b 108
pathfindr 16:3bf5f1a5f869 109 #endif