#ifndef _UART_TRANSFER_H
#define _UART_TRANSFER_H

#include "include.h"

#define USER_RINGBUFF  1  //使用环形缓冲区形式接收数据
#if  USER_RINGBUFF
/**如果使用环形缓冲形式接收串口数据***/
#define  RINGBUFF_LEN          1024     //定义最大接收字节数
#define  FLASE   1
#define  TRUE    0
void RingBuff_Init(void);
u8 Write_RingBuff(u8 data);
u8 Read_RingBuff(u8 *rData);
void Send_RingBuffOver(void);   //发送数据结束后需调用它
typedef struct
{
    u16 Head;
    u16 Tail;
    u16 Lenght;
	u16 sendlen;
    u8 Ring_Buff[RINGBUFF_LEN];
}volatile RingBuff_t;
extern volatile RingBuff_t ringBuff;//创建一个ringBuff的缓冲区
#endif


void uart0_init(u32 baud);
void uart1_init(u32 baud);
void uart2_init(u32 baud);

void uart0_SendByte(uint8_t Byte);
void uart0_SendArray(uint8_t *Array, uint16_t Length);
void uart0_SendString(char *String);
void uart0_SendNumber(uint32_t Number, uint8_t Length);

void uart1_SendByte(uint8_t Byte);
void uart1_SendArray(uint8_t *Array, uint16_t Length);
void uart1_SendString(char *String);
void uart1_SendNumber(uint32_t Number, uint8_t Length);

void uart2_SendByte(uint8_t Byte);
void uart2_SendArray(uint8_t *Array, uint16_t Length);
void uart2_SendString(char *String);
void uart2_SendNumber(uint32_t Number, uint8_t Length);

#endif // _UART_TRANSFER_H
