init

Dependencies:   aconno_I2C Lis2dh12 WatchdogTimer

main.h

Committer:
pathfindr
Date:
2019-05-16
Revision:
50:a94e70c00fff
Parent:
49:15ddd84ec9fa
Child:
51:9078e6928412

File content as of revision 50:a94e70c00fff:

/*
================================================================================
Project:    GPS Tracker
Module:     ---
Status:     Development
Type:       .h header file
Copyright (c) 2018 Pathfindr Ltd
All Rights Reserved.
================================================================================
Notes:
================================================================================
*/
#ifndef MAIN_INTERFACE_H_
#define MAIN_INTERFACE_H_

//------------------------------------------------------------------------------
//DEFINES
//------------------------------------------------------------------------------ 
#define FW_VERSION          18
//#define SKU                 "GPSPLUSDEV"
#define SKU                 "GPSPLUS"
#define HW_MAJORREVISION    "001"

//MODES
#define USE_NRF_TEMP_SENSOR                 1
#define DEBUG_ON                            1

//DEFAULT SETTINGS
#define DEFAULT_SLEEP_FRAME                 60000
#define DEFAULT_FORCE2G                     false
#define DEFAULT_LOCATION_MODE               1
#define DEFAULT_LOCATION_ACCURACY           1  // 0 = no location, 1 = cl only, 2 = gps then cl
#define DEFAULT_LOCATION_TX_INTERVAL_MINS   1440
#define DEFAULT_LOCATION_TX_FAILSAFE_HRS    168
#define DEFAULT_LOCATION_TIMEOUT            120
#define DEFAULT_MOTION_G                    7
#define DEFAULT_MOTION_START_SECONDS        120
#define DEFAULT_MOTION_STOP_SECONDS         120
#define DEFAULT_IMPACT_G                    127
#define DEFAULT_CONNECTION_ATTEMPTS         1
#define DEFAULT_CONNECTION_TIMEOUT          140
#define DEFAULT_BEACON_INTERVAL_SECONDS     20
#define DEFAULT_MAX_FAILED_CONNECTIONS      2 //max number of failed connections before device stops broadcasting until movement detected
#define DEFAULT_MAX_FAILED_GPS              2 //max number of failed gps searches before device stops trying gps until movement detected

//CONSTS
#define ONEDAYINSECONDS                     86400
#define THREEDAYSINSECONDS                  259200
#define SEVENDAYSINSECONDS                  604800
#define TENDAYSINSECONDS                    864000

//DEFINES
#define ACTIVITY_BUFFERSIZE                 100

//------------------------------------------------------------------------------
//mbed Libraries
//------------------------------------------------------------------------------
#include "mbed.h"
#include "nrf_soc.h"
#include "nrf_temp.h"
#include "board.h"
//#include "ble/BLE.h"
//#include "nvstore.h"
#include "FlashIAPBlockDevice.h"

//------------------------------------------------------------------------------
//peripheral Libraries
//------------------------------------------------------------------------------
#include "WatchdogTimer.h"
#include "LIS3DH.h"
#include "SI7060.h"
#include "acd_nrf52_saadc.h"

//------------------------------------------------------------------------------
//Application headers
//------------------------------------------------------------------------------
#include "NRFuart.h"
#include "app_data.h"
#include "states.h"
#include "common.h"
#include "sensors.h"
#include "modem.h"

//------------------------------------------------------------------------------
//Global macros
//------------------------------------------------------------------------------
//#define lowByte(w) ((uint8_t) ((w) & 0xff))
//#define highByte(w) ((uint8_t) ((w) >> 8))

//------------------------------------------------------------------------------
//GLOBAL VARS
//------------------------------------------------------------------------------ 

extern bool GLOBAL_accel_healthy;
extern bool GLOBAL_requireSoftReset;
extern bool GLOBAL_motionFlagTriggered;
extern bool GLOBAL_debugLED;
extern bool GLOBAL_needToConfigureLis3dh;
extern bool GLOBAL_registeredOnNetwork;
extern bool GLOBAL_modemOn;
extern bool GLOBAL_LEDSequenceinProgress;
extern time_t GLOBAL_RTCunixtime;
extern time_t GLOBAL_wakeTime;
extern char GLOBAL_debug_buffer[200];
extern uint8_t RTCtick_ledflash_count;
//FUNCS
extern void watchdogKick();

#endif