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

int main(void)
{
    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  T16B0_MAT0 Output 100ms \n\r");
    printf("\n  toggle P0.7\n\r");

    GPIO_SetPinMFType(OB_GPIO0, GPIO_PIN7, GPIO_MF_TIMER16B0_MAT); // T16B0_MAT0
    TIMER16_SetExternalMatch(OB_CT16B0, TIMER16_EMATCH0, TIMER16_EMATCH_TOGGLE);
    TIMER16_ToggleOut(OB_CT16B0, TIMER16_EMATCH0, 100000);
    TIMER16_Enable(OB_CT16B0);
    while(1);
}
