/*
 * Copyright (c) 2006-2022, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-08-20     BruceOu      first implementation
 */

#include <stdio.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>

int main(void)
{
    rt_device_t dev = RT_NULL;
    char buf[] = "Hello GD with RT-thread!\r\n";

    while (RT_NULL == dev) {
        dev = rt_device_find("vcom");
    }

    rt_thread_mdelay(5000);

    if (dev) {
        rt_device_open(dev, RT_DEVICE_FLAG_RDWR);
    } else {
        return -RT_ERROR;
    }

    while (1)
    {
        rt_device_write(dev, 0, buf, rt_strlen(buf));
        rt_thread_mdelay(500);
    }

    return RT_EOK;
}
