#ifndef		__Printf_H_
#define		__Printf_H_
//硬件定义
#define	PrintfUsart USART3
#define	Printf_DMA	DMA1

#define Printf_TX_DMAAddrSet(x) (DMA1_Channel2->CMAR = x)       //设置发送缓存地址
#define Printf_TX_DMALenSet(x)  (DMA1_Channel2->CNDTR = x)      //设置发送DMA长度
#define Printf_TX_DMAStart()     DMA_Cmd(DMA1_Channel2,ENABLE)  //开启发送DMA
#define Printf_TX_DMAStop()      DMA_Cmd(DMA1_Channel2,DISABLE) //开启发送DMA
#define	Printf_TX_DMAy_Channelx  DMA1_Channel2                  //Printf发送使用的DMA通道


#define USART3_Print       GPIO_ResetBits(GPIOA,GPIO_Pin_4);//485接收使能


//=============================================================================
//字符定义
#define	LF	   0x0a						//打印换行命令
#define	ESC	   0X1B            
#define	J	     0x4A              
#define	DLE	   0X10
#define	EOT	   0X04
#define	PCR    0X0D

#define	C_PrintPageLen	10		//定义页长
#define	C_multiple			2				//放大倍数
#define	C_leftSpace 		1				//右限
#define	C_rightSpace 		0				//右限
#define	C_wordSpace			1				//字间距
#define	C_rowSpace	   	4			  //行间距

typedef enum
{
  noSend,				
  sending,		
}printProStae_TypeDef; 

//******************************************************************************
//*-------------- 变量声名 -----------------------------------------------------
//******************************************************************************
											
//******************************************************************************
//*-------------- 函数声名 -----------------------------------------------------
//******************************************************************************
extern	void printUsartIsr(void);
extern	void printTxDmaInt(void);
extern	void printSend(u8 *pData, u8 len);
extern  void Print_Num(u8 GunNum,u8 Lin,u64 Num,u8 Dec);
extern	uint8_t	print_init(uint8_t *pdata);
extern	uint8_t	printChinese(uint8_t *pData);
extern	uint8_t	printLF(uint8_t *pdata);
extern	uint8_t	printCR(uint8_t *pData);
extern	uint8_t	LFnRow(uint8_t *pData,uint8_t row);
extern	uint8_t	setPageLen(uint8_t *pData,uint8_t pageLen);
extern	uint8_t	setLeftSpace(uint8_t *pData,uint8_t spaceNumber);
extern	uint8_t	setRightSpace(uint8_t *pData,uint8_t spaceNumber);
extern	uint8_t	setWordSpace(uint8_t *pData, uint8_t wordSpace);
extern	uint8_t	setRowSpace(uint8_t *pData, uint8_t rowSpace);
		

typedef enum
{
	PT_Null,
	PT_LastRecord,       
  PT_Record, 	

}PrintItem;

extern void Printf_DMATX_IRQHandler(void);

extern void Printf_Init(void);
extern void PrintfTask(void);
void Printf_UpData(u8 GunNum, PrintItem Type);
#endif	//#ifndef		
