/**********************************************************************
 *****  INCLUDE FILE FOR IMPLEMENT CORE LIBRARY			          *****
 *****  (WARNING: do not change variable names				      *****
 *****                                                            *****
 *****  Name: core_lib.h                                          *****
 *****  Desc: primary file for implementation core library	      *****
 *****  Ver.: 1.0                                                 *****
 *****  Date: 01/2011		                                      *****
 *****  Auth: Martin Mechacek		                              *****
 *****  Comp: ESTELAR s.r.o.									  *****
 *****                                                            *****
 *****  Copyright ESTELAR s.r.o. (c) 2010, all rights reserved    *****
 **********************************************************************/ 

#ifndef __CORE_LIB_H
#define __CORE_LIB_H

/**********************************************************************
 *****  IMPLEMENTATION AREA							 			   ****
 *****  following steps for implement bus_core into your project   ****
 *********************************************************************/ 

//(1)------------------------------------------------------------------
// copy and include file core_lib.h into your project
// set the compiler macro CORE_xxxx (where xxxxx is module type)
// some macro in file _core_def.h must be exist

//(2)------------------------------------------------------------------
// set the path for loading core library header files
#include "../../../CommonFiles/_core_def.h"

#include "../../../CommonFiles/_core_func.h"             
#include "../../../CommonFiles/_core_bus.h"             
#include "../../../CommonFiles/_core_data.h"             
#include "../../../CommonFiles/_core_err.h"      // use constants from here       
#include "../../../CommonFiles/_core_pac.h"      // use constants from here       

// ------------------------------------------------------------------
// define file for hw layer according to your platform
//#include "../../CommonFiles/def_GR-U01.h"             

//(3)------------------------------------------------------------------
// call DataInitVar() at start your application after MCU initialisation
// call CoreInitVar() at start your application 
// call BusInit() during serial init
// and configure VRXD pin

//(4)------------------------------------------------------------------
// call DataAddrSet(idAdr) for store bus address of your unit
// and update this at change

//(5)------------------------------------------------------------------
// call BusRecvByte() in receive interrupt routine
// call BusClearBuf() after BusRecvByte() if receive error occurred 

//(6)------------------------------------------------------------------
// call BusTimer() in timer interrupt routine - accurate timing is necessary (1,64ms)
// 												or modify BUS_FREE_TIMEOUT, BUS_WAIT_TIMEOUT constants

//(7)------------------------------------------------------------------
// call SCI_RecvPacket() for every received bytes and process packet accordance with return state
// call DataInitParse() when packet process is done

//(8)------------------------------------------------------------------
// call SCI_PutPacket for put data on bus

//(9)------------------------------------------------------------------
// call DateTimeUpdate() if received packet SYS_TIME_MESSAGE for store date and time
// use GetTimeDelta() for calculate addition time and compare it with gTimeDelta
// clear value gTimeDelta after use





/////// end of IMPLEMENTATION AREA ///////////////////////////////////*/

#endif 		// __CORE_LIB_H

