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

int main(void)
{
    SystemCoreClockUpdate();
    GPIO_SetPinMFType(OB_GPIO2, GPIO_PIN0, GPIO_MF_UART1_RX);
    GPIO_SetPinMFType(OB_GPIO2, GPIO_PIN1, GPIO_MF_UART1_TX);
    UART_Open(OB_UART1, 19200);
    printf("\n  Output 100ms (P3.2) \n\r");

    GPIO_SetPinMFType(OB_GPIO3, GPIO_PIN2, GPIO_MF_TIMER16B0_MAT); //MAT0
    TIMER16_SetExternalMatch(OB_CT16B0, TIMER16_EMATCH0, TIMER16_EMATCH_TOGGLE);
    TIMER16_ToggleOut(OB_CT16B0, TIMER16_EMATCH0, 100000);
    TIMER16_Enable(OB_CT16B0);
    while(1);
}
