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

int main(void)
{
    SystemCoreClockUpdate();

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

    printf("\n  T32B0_MAT2 Output 150ms \n\r");
    printf("\n  toggle P3.2\n\r");

    GPIO_SetPinMFType(OB_GPIO3, GPIO_PIN2, GPIO_MF_TIMER32B0_MAT);
    TIMER32_SetExternalMatch(OB_CT32B0, TIMER32_EMATCH2, TIMER32_EMATCH_TOGGLE);
    TIMER32_ToggleOut(OB_CT32B0, TIMER32_EMATCH2, 150000); // uint = us
    TIMER32_Enable(OB_CT32B0);
    while(1);
}
