From e61d7ce84bdd39646169be0135dec8bdc9319590 Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Sat, 10 Oct 2026 10:31:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=B2=E5=8F=A3=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E5=BC=82=E5=B8=B8=EF=BC=8C=E5=A2=9E=E5=A4=A7=E4=B8=B2?= =?UTF-8?q?=E5=8F=A3=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bspMCU/l_uart.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bspMCU/l_uart.c b/bspMCU/l_uart.c index 02ab10d..6c2748c 100644 --- a/bspMCU/l_uart.c +++ b/bspMCU/l_uart.c @@ -45,11 +45,14 @@ static int l_com_new(lua_State *L) if (id == 1 || id == 2) { - TUartUserData *ptUartUserData = UART_userdata_init(LUACOM_ID, baudrate, 0); + TUartUserData *ptUartUserData = UART_userdata_init(LUACOM_ID, baudrate, 4096); if (NULL == ptUartUserData) { lua_print("com is already used\n"); - return g_ptCom1; + u->m_ptComCtrl = g_ptCom1; + luaL_getmetatable(L, "stm32.COMMT"); + lua_setmetatable(L, -2); + return 1; } g_ptCom1 = rd_ComCreate(NULL, NULL, COM1_Send, ptUartUserData->m_buf_size, ptUartUserData); UART_IT_init(g_ptCom1); @@ -62,8 +65,11 @@ static int l_com_new(lua_State *L) g_ptCom0 = bsp_usb_init(); #endif #else - TUartUserData *ptUartUserData = UART_userdata_init(0, baudrate, 0); - if (NULL == ptUartUserData) lua_print("com is already used\n"); + TUartUserData *ptUartUserData = UART_userdata_init(0, baudrate, 4096); + if (NULL == ptUartUserData) + { + lua_print("com is already used\n"); + } g_ptCom0 = rd_ComCreate(NULL, NULL, COM0_Send, ptUartUserData->m_buf_size, ptUartUserData); UART_IT_init(g_ptCom0); #endif