![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
init
Dependencies: aconno_I2C Lis2dh12 WatchdogTimer
main.h@52:bd7678eade77, 2019-05-29 (annotated)
- Committer:
- pathfindr
- Date:
- Wed May 29 22:59:12 2019 +0000
- Revision:
- 52:bd7678eade77
- Parent:
- 51:9078e6928412
- Child:
- 54:2840f2d50734
ble funcs
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 | #ifndef MAIN_INTERFACE_H_ |
pathfindr | 0:94b743e06998 | 14 | #define MAIN_INTERFACE_H_ |
pathfindr | 0:94b743e06998 | 15 | |
pathfindr | 0:94b743e06998 | 16 | //------------------------------------------------------------------------------ |
pathfindr | 52:bd7678eade77 | 17 | //FW DETAILS |
pathfindr | 41:07e41dbd5304 | 18 | //------------------------------------------------------------------------------ |
pathfindr | 52:bd7678eade77 | 19 | #define FW_VERSION 328 |
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 | 52:bd7678eade77 | 24 | //OPTIONS |
pathfindr | 52:bd7678eade77 | 25 | #define USE_NRF_TEMP_SENSOR false |
pathfindr | 52:bd7678eade77 | 26 | #define BLE_ENABLED true |
pathfindr | 41:07e41dbd5304 | 27 | |
pathfindr | 52:bd7678eade77 | 28 | //DEFAULT VELUES |
pathfindr | 52:bd7678eade77 | 29 | #define DEFAULT_SLEEP_FRAME 30000 |
pathfindr | 50:a94e70c00fff | 30 | #define DEFAULT_FORCE2G false |
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 | 49:15ddd84ec9fa | 41 | #define DEFAULT_CONNECTION_TIMEOUT 140 |
pathfindr | 51:9078e6928412 | 42 | #define DEFAULT_MAX_FAILED_CONNECTIONS 3 //max number of failed connections before device stops broadcasting until movement detected |
pathfindr | 51:9078e6928412 | 43 | #define DEFAULT_MAX_FAILED_GPS 3 //max number of failed gps searches before device stops trying gps until movement detected |
pathfindr | 52:bd7678eade77 | 44 | #define DEFAULT_MAX_MODEMBROWNOUTS 2 |
pathfindr | 52:bd7678eade77 | 45 | #define DEFAULT_BEACON_INTERVAL_SECONDS 10 |
pathfindr | 52:bd7678eade77 | 46 | #define DEFAULT_BEACON_POWER 4 //(accepted values are -40, -30, -20, -16, -12, -8, -4, 0, and 4 dBm) |
pathfindr | 41:07e41dbd5304 | 47 | |
pathfindr | 41:07e41dbd5304 | 48 | //CONSTS |
pathfindr | 41:07e41dbd5304 | 49 | #define ONEDAYINSECONDS 86400 |
pathfindr | 41:07e41dbd5304 | 50 | #define THREEDAYSINSECONDS 259200 |
pathfindr | 41:07e41dbd5304 | 51 | #define SEVENDAYSINSECONDS 604800 |
pathfindr | 41:07e41dbd5304 | 52 | #define TENDAYSINSECONDS 864000 |
pathfindr | 41:07e41dbd5304 | 53 | |
pathfindr | 51:9078e6928412 | 54 | //MODES |
pathfindr | 51:9078e6928412 | 55 | #define LOCATION_MODE_INTERVAL 1 |
pathfindr | 51:9078e6928412 | 56 | #define LOCATION_MODE_INTERVAL_MOTION 2 |
pathfindr | 51:9078e6928412 | 57 | #define LOCATION_MODE_INTELLIGENT 3 |
pathfindr | 51:9078e6928412 | 58 | #define LOCATION_MODE_REALTIME 4 |
pathfindr | 51:9078e6928412 | 59 | |
pathfindr | 45:6c7f5b556d74 | 60 | //DEFINES |
pathfindr | 45:6c7f5b556d74 | 61 | #define ACTIVITY_BUFFERSIZE 100 |
pathfindr | 52:bd7678eade77 | 62 | #define DEBUG_BUFFERSIZE 200 |
pathfindr | 45:6c7f5b556d74 | 63 | |
pathfindr | 41:07e41dbd5304 | 64 | //------------------------------------------------------------------------------ |
pathfindr | 0:94b743e06998 | 65 | //mbed Libraries |
pathfindr | 0:94b743e06998 | 66 | //------------------------------------------------------------------------------ |
pathfindr | 0:94b743e06998 | 67 | #include "mbed.h" |
pathfindr | 51:9078e6928412 | 68 | //#include "nrf_soc.h" |
pathfindr | 7:e9a19750700d | 69 | #include "board.h" |
pathfindr | 52:bd7678eade77 | 70 | #if BLE_ENABLED |
pathfindr | 52:bd7678eade77 | 71 | #include "ble/BLE.h" |
pathfindr | 52:bd7678eade77 | 72 | #endif |
pathfindr | 0:94b743e06998 | 73 | //------------------------------------------------------------------------------ |
pathfindr | 2:fd554f01abdf | 74 | //peripheral Libraries |
pathfindr | 0:94b743e06998 | 75 | //------------------------------------------------------------------------------ |
pathfindr | 34:4493c9f6d707 | 76 | #include "WatchdogTimer.h" |
pathfindr | 0:94b743e06998 | 77 | #include "LIS3DH.h" |
pathfindr | 52:bd7678eade77 | 78 | #include "SI7060.h" |
pathfindr | 14:9a54b1b65bc8 | 79 | #include "acd_nrf52_saadc.h" |
pathfindr | 0:94b743e06998 | 80 | |
pathfindr | 0:94b743e06998 | 81 | //------------------------------------------------------------------------------ |
pathfindr | 0:94b743e06998 | 82 | //Application headers |
pathfindr | 0:94b743e06998 | 83 | //------------------------------------------------------------------------------ |
pathfindr | 36:8e359069192b | 84 | #include "NRFuart.h" |
pathfindr | 34:4493c9f6d707 | 85 | #include "app_data.h" |
pathfindr | 16:3bf5f1a5f869 | 86 | #include "states.h" |
pathfindr | 7:e9a19750700d | 87 | #include "common.h" |
pathfindr | 7:e9a19750700d | 88 | #include "sensors.h" |
pathfindr | 7:e9a19750700d | 89 | #include "modem.h" |
pathfindr | 5:8f8951127724 | 90 | |
pathfindr | 52:bd7678eade77 | 91 | //BLE SERVICE IDS |
pathfindr | 52:bd7678eade77 | 92 | #define BLE_SERVICEID_GPSPLUS 0xfb10 |
pathfindr | 52:bd7678eade77 | 93 | #define BLE_SERVICEID_PFDETECTOR1 0x4e96 |
pathfindr | 52:bd7678eade77 | 94 | #define BLE_SERVICEID_PFBEACON1 0xfe9a //ESTIMOTE |
pathfindr | 52:bd7678eade77 | 95 | #define BLE_SERVICEID_BT04 0xcbff //TZBT04 Temp/humid |
pathfindr | 52:bd7678eade77 | 96 | #define BLE_SERVICEID_PFBEACON2 0xfb20 |
pathfindr | 52:bd7678eade77 | 97 | |
pathfindr | 0:94b743e06998 | 98 | //------------------------------------------------------------------------------ |
pathfindr | 0:94b743e06998 | 99 | //Global macros |
pathfindr | 0:94b743e06998 | 100 | //------------------------------------------------------------------------------ |
pathfindr | 16:3bf5f1a5f869 | 101 | //#define lowByte(w) ((uint8_t) ((w) & 0xff)) |
pathfindr | 16:3bf5f1a5f869 | 102 | //#define highByte(w) ((uint8_t) ((w) >> 8)) |
pathfindr | 0:94b743e06998 | 103 | |
pathfindr | 36:8e359069192b | 104 | //------------------------------------------------------------------------------ |
pathfindr | 36:8e359069192b | 105 | //GLOBAL VARS |
pathfindr | 36:8e359069192b | 106 | //------------------------------------------------------------------------------ |
pathfindr | 36:8e359069192b | 107 | |
pathfindr | 13:29f67f256709 | 108 | extern bool GLOBAL_accel_healthy; |
pathfindr | 13:29f67f256709 | 109 | extern bool GLOBAL_requireSoftReset; |
pathfindr | 13:29f67f256709 | 110 | extern bool GLOBAL_motionFlagTriggered; |
pathfindr | 13:29f67f256709 | 111 | extern bool GLOBAL_debugLED; |
pathfindr | 13:29f67f256709 | 112 | extern bool GLOBAL_needToConfigureLis3dh; |
pathfindr | 13:29f67f256709 | 113 | extern bool GLOBAL_registeredOnNetwork; |
pathfindr | 22:810425eb76e1 | 114 | extern bool GLOBAL_modemOn; |
pathfindr | 33:760005331b4c | 115 | extern bool GLOBAL_LEDSequenceinProgress; |
pathfindr | 13:29f67f256709 | 116 | extern time_t GLOBAL_RTCunixtime; |
pathfindr | 13:29f67f256709 | 117 | extern time_t GLOBAL_wakeTime; |
pathfindr | 52:bd7678eade77 | 118 | extern char GLOBAL_debug_buffer[DEBUG_BUFFERSIZE]; |
pathfindr | 52:bd7678eade77 | 119 | extern char GLOBAL_GPSlocString_prev[70]; |
pathfindr | 52:bd7678eade77 | 120 | extern bool GLOBAL_have_GPSlocString_prev; |
pathfindr | 20:5404841fdd2b | 121 | //FUNCS |
pathfindr | 20:5404841fdd2b | 122 | extern void watchdogKick(); |
pathfindr | 20:5404841fdd2b | 123 | |
pathfindr | 16:3bf5f1a5f869 | 124 | #endif |