#pragma once
#include "adt8949.h"

#define  MAXAXIS  4    //最大轴数

//////////////////////////////////////////////////////////////////////////
//
// [12/11/2012 Administrator]:将该类设计成一个单例，以代替以前版本中的全局变量g_Ctrlcard
class CCtrlCardSingletion  
{
// 用于控制卡的函数
public:
	int InitBoard();
	void GetVersion(int &fLibVer, int &fHardwareVer);
	int GetStatus(int nCardNo, int nAxis, int *nValue);
	int SetupSpeed(int nAxis, float nStartv, float nSpeed, float nAdd,float nDec,unsigned short ADMode);
	int SetupPos(int nAxis, long nPos, int nMode);
	int AxisPmove(int nAxis ,float nValue);
	int GetCurrentInfo(int nAxis, long &nLogPos, long &nActPos, float &fSpeed);
	int INP_GetCurrentInfo(int nAxis, long &nLogPos, long &nActPos, float &fSpeed);
	int StopRun(int nAxis, int nMode);	
	int InterpMove1(int axis1,  float value1);
	int InterpMove2(int axis1, int axis2, float value1, float value2);
	int InterpMove3(int axis1, int axis2, int axis3, float value1, float value2, float value3);
	int InterpMove4(float value1, float value2, float value3, float value4);
	int ReadInput(int nNumber);
	int WriteOutput(int nNumber, int nValue);
	int SetupPulseMode(int nAxis, int nValue);
	int SetupLimitMode(int nAxis, int nValue1, int nValue2, int nLogic);
	int SetupStop0Mode(int nAxis, int nValue, int nLogic,int admode);
	int SetupStop1Mode(int nAxis, int nValue, int nLogic,int admode);
	int SetupHardStop(int nValue, int nLogic);	
	int GetOutNum(int nNumber);
	int SetAccDecAndSpeed(int axis,float add,float dec,float startv, float speed, float endv);
// 重要的函数
public:
	static CCtrlCardSingletion *Instance();
	static void ReleaseCtrlCardSingletion();

protected:
	CCtrlCardSingletion();
	virtual ~CCtrlCardSingletion();

// 唯一性	
private:
	static CCtrlCardSingletion *m_pInstance;
};
