#include "stdio.h"
#include "OB90A64U1.h"
#include "timer32.h"
#include "uart.h"
#include "gpio.h"

int main(void)
{
    uint32_t nBuff;
    SystemCoreClockUpdate();
    GPIO_SetPinMFType(OB_GPIO0, GPIO_PIN14, GPIO_MF_UART_RX);
    GPIO_SetPinMFType(OB_GPIO0, GPIO_PIN13, GPIO_MF_UART_TX);
    UART_Open(OB_UART0, 19200);

    //--------------------------------
    printf("\n  Output 1ms (P3.0) \n\r");

    GPIO_SetPinMode(OB_GPIO3,GPIO_PIN0, GPIO_PINMODE_PULL_UP);//GPIO Mode = Pull up
    while(1)
    {
        nBuff = 1000;
        while(1)
        {
            //Delay 1m second
            OB_GPIO3->DATA_b.GPIOXDATA0 = 0x00;
            TIMER32_Delay(OB_CT32B0, nBuff);
            OB_GPIO3->DATA_b.GPIOXDATA0 = 0x01;
            TIMER32_Delay(OB_CT32B0, nBuff);
        }
    }
}
