//*************************************************************************************************
// @Module              Communication
// @Filename            COMM.H
// @Controller          XC88x Series
//
//
// @Description   This file contains references for Communication Protocol
//*************************************************************************************************


//*************************************************************************************************
// @Includes
//*************************************************************************************************

//*************************************************************************************************
// @Global Variables Declaration
//*************************************************************************************************

//*************************************************************************************************
// @Prototypes Of Functions
//*************************************************************************************************

//*************************************************************************************************
// @Macros
//*************************************************************************************************

#define SER_VERSION 0x00A1	

#if DAVECG_BLOCK_COMMUTATION
#if DAVECG_BTS
#define TRACE_LOAD 256
#endif
#else
#define TRACE_LOAD 200
#endif


#if DAVECG_VOLTAGE_CTRL
#define SCODE_CS 0x0
#elif DAVECG_CURRENT_CTRL
#define SCODE_CS 0x1
#elif DAVECG_SPEED_CTRL
#define SCODE_CS 0x2
#elif DAVECG_SPEED_ENC_CTRL
#define SCODE_CS 0x3
#elif DAVECG_SPEED_CURRENT_CTRL
#define SCODE_CS 0x4
#elif DAVECG_SPEED_CURRENT_ENC_CTRL
#define SCODE_CS 0x5
#endif

#if DAVECG_BTS
#define SCODE_PB 0x0
#elif DAVECG_TLE
#define SCODE_PB 0x1
#else
#define SCODE_PB 0x0
#endif

#if DAVECG_HALL
#define SCODE_CT 0x0
#endif
#if DAVECG_BEMF
#if START_RAMP == 0
#define SCODE_CT 0x1
#elif   START_RAMP == 1
#define SCODE_CT 0x9
#endif
#endif

#if DAVECG_BLOCK_COMMUTATION
#define SCODE_CA 0x0
#endif

#if DAVECG_KEIL
#define SCODE_COMPILER 0x2
#endif


#define STECKERCODE (SCODE_CS | (SCODE_PB << 4) | (SCODE_CT << 8) | (SCODE_CA << 12) | (SCODE_COMPILER << 14))

#define ADDRESS_LENGTH  31                                 // Number of variables accessible by Control Panel.

#define SIO_INIT() sio_init();

#if DAVECG_BLOCK_COMMUTATION
#define TRACE() trace();
#endif

#define COMM_FUNC_DECL()\
    extern void sio_init(void);\
    extern void iiup(void);\
    extern void trace(void);

//*************************************************************************************************
// @Defines
//*************************************************************************************************

//*************************************************************************************************
// @Typedefs
//*************************************************************************************************

