//----------------------------------------------------
/**
	\file		gvariables.h

	\brief		Globalni promenne
				<<< ALL >>>

	\author		ConTeK s.r.o., Pavel Vavra
	\version	01.01
	\date		24.5.2012
*/
//----------------------------------------------------

#ifndef _G_VARIABLES_H_
#define _G_VARIABLES_H_

#include <paramstore.h>
#include <timeticks.h>
#include <hwboard.h>
#include <hwsubmdl.h>
#include <iolib.h>
#include <ioboard.h>

#include "appsets.h"
#include "XmlVariables.h"

#include "thermocouple.h"
#include "lambda.h"
#include "photox.h"


//-----------------------------------------------------
/**
	\brief	Kontexty pameti
*/
//-----------------------------------------------------

#ifdef MSVC
#include "filemem.h"
  extern FILEMEM_CTX		gFram;	//!< Kontext souborove pameti
#else
#ifdef USEHW_FRAM
  extern TWIDESC			gTwi;	//!< Kontext twi komunikace
  extern FRAM_CTX			gFram;	//!< Kontext fram pameti
#endif
#endif //MSVC

extern uint8_t			gPstBuf[sizeof(gParam.Pst)];


//-----------------------------------------------------
/**
	\brief	Kontext ukladani do flash a fram
*/
//-----------------------------------------------------

extern PARAMSTORE_CTX gParCtxCtrl;		//!< kontext ukladani do flash a fram

//-----------------------------------------------------
/**
	\brief	
*/
//-----------------------------------------------------
extern DATADEF_CTX gCtxCtrl;

extern NVMEMDESC confMem;

//-----------------------------------------------------
/**
	\brief	Kontext vstupu/vystupu
*/
//-----------------------------------------------------

extern IOBOARD_CTX	gIOBoardCtx;	//!< kontext ioboard desky

extern uint8_t		gDInpVal[IOBOARD_DINP_B_COUNT];		//!< digitalni vstupy
extern uint8_t		gDInpX[IOBOARD_DINP_B_COUNT];		//!< invertovane digitalni vstupy
extern uint8_t		gDOutpVal[IOBOARD_DOUTP_B_COUNT];	//!< digitalni vystupy
extern uint8_t		gDOutpX[IOBOARD_DOUTP_B_COUNT];		//!< invertovane digitalni vystupy
extern aiodata_t	gAInpVal[IOBOARD_AINP_COUNT];		//!< analogove vstupy
extern aiodata_t	gAOutpVal[IOBOARD_AOUTP_COUNT];		//!< analogove vystupy

extern DFILTER_CTX	gDInpFilter_DI_LEVER;									//!< kontext dig.filtru DI_LEVER
extern DFILTER_CTX	*gDInpFilter[IOBOARD_DINP_COUNT];	//!< pole digitalnich vstupu


extern AFILTER_FLOATAVG gAInpFilter_A;
extern AFILTER_CTX *gAInpFilter[IOBOARD_AINP_COUNT];

//-----------------------------------------------------
/**
	\brief	Kontexty jednotlivych automatu a knihoven
*/
//-----------------------------------------------------
extern THERMOCOUPLE_CTX gThermocouple;
extern LAMBDA_CTX		gLambda;
extern PHOTO_CTX		gPhoto;

#endif //_G_VARIABLES_H_
