#include "libc.h"
#include "drivers.h"
#include <math.h>

int main(void)
{
	u8_t input;
    //Init uart
	drv_uart_default_set(DRV_UART_ID_1);
	drv_uart_init();
	drv_uart1_init();
	drv_uart_common_baud_rate_set(drv_uart_second_get(), 9600);

    printf("Hello, Stone!\n");

    printf("sqrt = %f!\n", sqrt(2));

    timer_t test;

    timer_start(600000000UL, &test);

    while (!timer_expired(&test))
    {
    	input = 0;
    	if (drv_uart_common_getbyte(DRV_UART_ID_0, &input))
		{
    		drv_uart_common_putbyte(DRV_UART_ID_0, input);
		}
    	input = 0;
		if (drv_uart_common_getbyte(DRV_UART_ID_1, &input))
		{
			drv_uart_common_putbyte(DRV_UART_ID_1, input);
		}
    }

    printf("End!\n");

    return 0;
}
