/***************************************************************************************************
  Filename:       hal_nv_ti.h
  Revised:        $Date: $
  Revision:       $Revision: $

  Description:    Low Level NV intfc

 **************************************************************************************************/

#ifndef HAL_NV_TI_H
#define HAL_NV_TI_H

#include <stdint.h>
#include <stdbool.h>
#include "ComTypeDefs.h"
#include "types.h"
#include "radio_api.h"

/**************************************************************************************************
 *                                          CONSTANTS
 **************************************************************************************************/

#define INFO_MEM_BLOCK_SIZE		128

#define INFOA_MEM		0x1980
#define INFOB_MEM		0x1900
#define INFOC_MEM		0x1880
#define INFOD_MEM		0x1800

// Radio defaults
#define DEFAULT_AGG_ADDRESS		{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }
// Soil Sensors
#define DEFAULT_SAMPLING_INTERVAL	0
//#define DEFAULT_SSS_NUM_SENSORS	0
#define DEFAULT_SSS_NUM_SENSORS	1 // was 4 - will be sum of DAFE connected Sensors
// Analog Sensors
#define DEFAULT_ANA_CONFIG		0x38		// external ana sensors - 0x7, internal batt/vdd/temp 0x38
#define DEFAULT_ANA_INTERVAL	0
#define DEFAULT_ANA_AVERAGING	5

#define DEFAULT_RADIO_MODE		RADIO_MODE_NORMAL		// Default to Normal radio mode (API1 mode disabled)
#define DEFAULT_SLEEP_MODE		1			// Default to enable Sleep radio mode (normal)

/**************************************************************************************************
*                                           EXTERNS
**************************************************************************************************/

// INFO NV variables

//@1900
// Aggregator (GW) EUI (address)
extern const addr64 nv_agg_address;
// # of seconds in sampling internal for both pixl & analog sensors (0=disabled)
extern const uint16_t nv_sampling_interval;
// # of soil sensors expected (0- disabled)
extern const uint8_t nv_sss_num_sensors;
// # analog sensors configuration bit enable fields:
//    b0-ana1, b1=ana2, b2=ana3, b3=Vbatt, b4=VCC, b5=Temp (MSP)
extern const uint8_t nv_ana_config;
// # of seconds in Analog sensors sampling interval (0=disabled)
extern const uint16_t nv_ana_interval;
// # of times to sample and average each analog sample (@ 100ms sample period). Must be <= 16
extern const uint16_t nv_ana_averaging;

//@1910
// Default radio mode to startup in
extern const uint8_t nv_radio_mode;
// Default radio mode to startup in
extern const uint8_t nv_sleep_mode;

/**************************************************************************************************
 *                                        FUNCTIONS - PUBLIC API
 **************************************************************************************************/

extern Result_t HalNV_write( uint8_t *data, uint32_t addr, uint8_t len );


#endif //HAL_NV_TI_H
