// UART demo Main Program

#include "hhd32f0xx.h"
#include "hhd_uart.h"
#include "hhd_sys.h"
//Main function entry
void delay(void)
{
	uint32_t i=0;	while (i++ < 0xff);
}
int main(void)
{
	uint8_t data;
	HHD32F0_UART_TypeDef  *uart;
	//system initial
	SYS_SystemInitial();
	//delay
	delay();
	#ifdef ENABLE_UART0
	uart=UART0;
	#endif
	#ifdef ENABLE_UART1
	uart=UART1;
	#endif
	//initial UART0
	UART_Open(uart,115200,UART_NO_PARITY,0);

	//Send Test String
	UART_PutString(uart,"This is an UART Test String!");
	
		
	// Loop forever 

	while(1)
	{
		//send received data
// 		if ((XN_UART0->STAT.bit.RXNE)&&(!(XN_UART0->STAT.bit.TXF)))
// 			XN_UART0->DAT.all=XN_UART0->DAT.all;
		if (!UART_ByteRead(uart,&data))
			UART_ByteWrite(uart,data);
	}

}

