/*
 * Copyright (c) 2006-2025, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2025-07-21     RT-Thread    first version
 */

#include <rtthread.h>
#include <board.h>
#define DBG_TAG "main"
#define DBG_LVL DBG_LOG
#include <rtdbg.h>
#include "./LED/LED.h"
#include "./usart/usart.h"
#include "./ngflowcal/FLowCal.h"

static rt_thread_t flowCal_thread = RT_NULL;

/* flowCal 线程入口函数 */
static void flowCal_thread_entry(void *parameter)
{

    while (1)
    {

        //NGFlowCal();
        /* 延时 500ms */
        rt_thread_mdelay(1000);
    }
}

int main(void)
{

    /* 系统时钟初始化成480MHz */
    //SystemClock_Config();
    //打开LED灯
    controlLED();

    int count = 1;

    /* 创建线程 */
    flowCal_thread = rt_thread_create("flowCal", flowCal_thread_entry,
    RT_NULL, 2048,
    RT_THREAD_PRIORITY_MAX / 2, 20);

    /* 启动线程 */
    if (flowCal_thread != RT_NULL)
    {
        rt_thread_startup(flowCal_thread);
        return RT_EOK;
    }
    else
    {
        return -RT_ERROR;
    }

    while (count++)
    {

        LOG_D("Hello RT-Thread!");
        rt_thread_mdelay(1000);
    }

    return RT_EOK;
}

