/*
 * TaskExecuter.h
 *
 * Created: 22.2.2016 23:05:02
 *  Author: Chenda
 */ 


#ifndef TASKEXECUTER_H_
#define TASKEXECUTER_H_

#include "DeviceAddresses.h"

#define APP_TIMER_PERIOD	200		//ms - currently not used

/************************************************************************/
/* Application structure                                                */
/************************************************************************/
struct stApplicationStructure {
	struct stMinimumStatusReportingStructure *SCPI_StatStr;
	
	struct stAPI_layers {
		struct stComAPI_layer *UART0;
		struct stRegAPI_layer *REG;
	}API;
	
	struct stCommandProccessing {
		uint8_t CMD_No;
		uint8_t CMD_phase;
		uint8_t CMD_src;
		uint8_t CMD_trg;
		uint8_t DATA_buff[255];
		uint8_t DATA_len;
		uint8_t MPC0;		// multi purpose counter 0
		uint8_t MPC1;		// multi purpose counter 1
		
		struct stComAPI_layer *SrcAPI;
		struct stComAPI_layer *TrgAPI;
	}CMD;
	
	struct stErrorHandling {
		uint8_t ERROR_No;
		uint8_t ERROR_src;
		uint8_t DATA_cmd;
		uint8_t DATA_buff[255];
		uint8_t DATA_len;
		bool InitiateReset;
	}ERROR;
	
	struct stTimerEvents {
		uint8_t Tick100ms;
		uint8_t OldCptSof;
	}T_EVENTS;	
};


/************************************************************************/
/* Function declaration                                                 */
/************************************************************************/
// Public Functions
void TE_INIT(void);
void TE(void);

#endif /* TASKEXECUTER_H_ */