|
|
@ -45,11 +45,14 @@ static int l_com_new(lua_State *L) |
|
|
|
|
|
|
|
|
if (id == 1 || id == 2) |
|
|
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) |
|
|
if (NULL == ptUartUserData) |
|
|
{ |
|
|
{ |
|
|
lua_print("com is already used\n"); |
|
|
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); |
|
|
g_ptCom1 = rd_ComCreate(NULL, NULL, COM1_Send, ptUartUserData->m_buf_size, ptUartUserData); |
|
|
UART_IT_init(g_ptCom1); |
|
|
UART_IT_init(g_ptCom1); |
|
|
@ -62,8 +65,11 @@ static int l_com_new(lua_State *L) |
|
|
g_ptCom0 = bsp_usb_init(); |
|
|
g_ptCom0 = bsp_usb_init(); |
|
|
#endif |
|
|
#endif |
|
|
#else |
|
|
#else |
|
|
TUartUserData *ptUartUserData = UART_userdata_init(0, baudrate, 0); |
|
|
TUartUserData *ptUartUserData = UART_userdata_init(0, baudrate, 4096); |
|
|
if (NULL == ptUartUserData) lua_print("com is already used\n"); |
|
|
if (NULL == ptUartUserData) |
|
|
|
|
|
{ |
|
|
|
|
|
lua_print("com is already used\n"); |
|
|
|
|
|
} |
|
|
g_ptCom0 = rd_ComCreate(NULL, NULL, COM0_Send, ptUartUserData->m_buf_size, ptUartUserData); |
|
|
g_ptCom0 = rd_ComCreate(NULL, NULL, COM0_Send, ptUartUserData->m_buf_size, ptUartUserData); |
|
|
UART_IT_init(g_ptCom0); |
|
|
UART_IT_init(g_ptCom0); |
|
|
#endif |
|
|
#endif |
|
|
|