#ifndef _UART_TRANSFER_H
#define _UART_TRANSFER_H

#include "include.h"

//Maximum length of received data，Cannot exceed 63
#define REC_BUF_MAX_LENGTH      50
#define REC_END_FLAG_1          0xad
#define REC_END_FLAG_2          0xcf

#define REC_STA_FINISH_MASK     0x80
#define REC_STA_PRE_MASK        0x40
#define REC_STA_LEN_MASK        0x3f

//**********************************
//*Bit [7]: receiving completion flag
//*Bit [6]: receive the first terminator flag
//*Bit [5:0]: received data length
//************************************
extern u8 REC_STA;
extern u8 REC_BUFF[REC_BUF_MAX_LENGTH];

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

#endif // _UART_TRANSFER_H
