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

int main(void)
{
    uint32_t nBuff;
    SystemCoreClockUpdate();

    GPIO_SetPinMFType(OB_GPIO0, GPIO_PIN1, GPIO_MF_UART0_RX);   // P0.1
    GPIO_SetPinMFType(OB_GPIO0, GPIO_PIN0, GPIO_MF_UART0_TX);   // P0.0
    UART_Open(OB_UART0, 19200);
    //--------------------------------

    printf("\n  T32B0_MR0 Output 3ms \n\r");
    printf("\n  toggle P0.6\n\r");

    GPIO_SetPinMode(OB_GPIO0,GPIO_PIN6, GPIO_PINMODE_PULL_UP);//GPIO Mode = Pull up
    while(1)
    {
        nBuff = 3000;
        while(1)
        {
            //Delay 3m second
            OB_GPIO0->DATA_b.GPIOXDATA6 = 0x00;
            TIMER32_Delay(OB_CT32B0, nBuff);
            OB_GPIO0->DATA_b.GPIOXDATA6 = 0x01;
            TIMER32_Delay(OB_CT32B0, nBuff);
        }
    }
}
