#include <stdio.h>
#include "OB90A64U1.h"
#include "uart.h"
#include "gpio.h"

extern volatile uint8_t  g_UartRxData[UART_RX_SIZE];
extern volatile uint32_t g_UartRxCounter;
extern volatile uint32_t g_UartInterrupt;

int main(void)
{
    uint32_t nLoop;

    SystemCoreClockUpdate();
    GPIO_SetPinMFType(OB_GPIO1, GPIO_PIN7, GPIO_MF_UART_RX);
    GPIO_SetPinMFType(OB_GPIO1, GPIO_PIN6, GPIO_MF_UART_TX);
    UART_Open(OB_UART1, 19200);
    //--------------- Set FIFO to be 14 BYTE --------------------------------
    OB_UART1->UFCR = (OB_UART1->UFCR  & 0x3F)| UART_FIFO_LEVEL_14BYTE;
    //--------------- enable Interrupt --------------------------------
    NVIC_EnableIRQ(UART1_IRQn);
    //----------------Put the DATA into FIFO ------------------------------------
    for (nLoop = 0x00; nLoop < 14; nLoop++)
    {
        OB_UART1->UTHR = nLoop;
    }
    UART_EnableInt(OB_UART1, UART_INT_THRE);
    g_UartInterrupt = 0x00;
    while(1);

}
