/* * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018-11-27 balanceTWK first version * 2023-12-03 Meco Man support nano version */ #include "rtdef.h" #include #ifndef RT_USING_NANO #include #endif /* RT_USING_NANO */ #include "VK_Client.h" #include "VK_Com.h" #include "drv_ec800k.h" #include "VK_Log.h" static rt_device_t u2, u3, vcom; static void task_let_entry(void *arg) { client_task(); } static void task_com_entry(void *arg) { com_task(); } int main(void) { /* Bring up diagnostics before UART initialization can fail. */ vcom = rt_device_find("vcom"); if (vcom != RT_NULL && rt_device_open(vcom, RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM) == RT_EOK) { dev_log_backend_init(vcom); } u3 = rt_device_find("uart3"); if (u3 == RT_NULL) { return -RT_ERROR; } rt_device_open(u3, RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX | RT_DEVICE_FLAG_RX_NON_BLOCKING | RT_DEVICE_FLAG_TX_BLOCKING); fmu_com_register(u3); u2 = rt_device_find("uart2"); if (u2 == RT_NULL) { return -RT_ERROR; } rt_device_open(u2, RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX | RT_DEVICE_FLAG_RX_NON_BLOCKING | RT_DEVICE_FLAG_TX_BLOCKING); BSP_LET_Register_Com(u2); /* 创建任务2和任务3,分别从U2和U3收发数据 */ lte_dev.tid1 = rt_thread_create("lte", task_let_entry, RT_NULL, 2048, 10, 5); if (lte_dev.tid1) { rt_thread_startup(lte_dev.tid1); } lte_dev.tid2 = rt_thread_create("com", task_com_entry, RT_NULL, 1024, 11, 5); if (lte_dev.tid2) { rt_thread_startup(lte_dev.tid2); } }