#ifndef __USART_H
#define __USART_H

#include "stm32f10x.h"

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <math.h>

#define EN_USART1	1	//1使能;0禁止;使能串口1
#define EN_USART2	1	//使能串口2
#define EN_USART3	0	

#define USART1_SEND_LEN	512	//定义DMA最大发送字节数
#define USART2_SEND_LEN	512
#define USART3_SEND_LEN	512
#define USART1_RECV_LEN	512	//定义DMA和接收缓冲最大字节数
#define USART2_RECV_LEN	1024
#define USART3_RECV_LEN	512	

extern char USART1_Recv_Buff[USART1_RECV_LEN];//接收缓冲,最大USART1_Recv_Buff个字节
extern char USART2_Recv_Buff[USART2_RECV_LEN];
extern char USART3_Recv_Buff[USART3_RECV_LEN];
extern u8 USART1_Recv_Flag;//接收状态标记	
extern u8 USART2_Recv_Flag;
extern u8 USART3_Recv_Flag;
extern u32 USART1_ReceDatalen;

void UART1_Init(u32 bound);
void UART2_Init(u32 bound);
void UART3_Init(u32 bound);
void USART1_DMA_SendStr(char *senddata);//串口1DMA发送程序
void USART2_DMA_SendStr(char *senddata);//串口2DMA发送程序
void USART3_DMA_SendStr(char *senddata);//串口3DMA发送程序
void USART1_SendByte(unsigned char c);//串口1发送一个字符
void USART1_SendStr(char * str);//串口1发送字符串
void USART2_SendByte(unsigned char c);//串口2发送一个字符
void USART2_SendStr(char * str);//串口2发送字符串
void USART3_SendByte(unsigned char c);//串口3发送一个字符
void USART3_SendStr(char * str);//串口3发送字符串
void my_printf(USART_TypeDef* USARTx, char *Data,...);
int SendChar (int ch);

#endif
