From 9f200e2e8351b8cf2125f2142435553c5dca9a93 Mon Sep 17 00:00:00 2001 From: YuanHongbin <975559679@qq.com> Date: Mon, 13 Jul 2026 15:34:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=B2=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E8=AF=95DCH=E9=80=9A=E9=81=93=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=97=A0=E6=95=88=E5=8F=8AUART0=E6=97=A0=E6=B3=95=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E8=B0=83=E8=AF=95=E6=8C=87=E4=BB=A4=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. DBGUartSend/DBGUartSendByte改为运行时通过gDebugChannel选择输出通道,替代编译期USE_BOOTLOADER宏 2. 启用Uart0_IRQHandler中的DebugUartIRQ调用,使UART0可接收调试指令 --- source/src/bsp.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/src/bsp.c b/source/src/bsp.c index f41ade4..2175306 100644 --- a/source/src/bsp.c +++ b/source/src/bsp.c @@ -703,21 +703,21 @@ void PrintfMess(void) } void DBGUartSendByte(uint8_t sData) { -#if USE_BOOTLOADER - LPUart_SendData(M0P_LPUART0, sData); -#else - Uart_SendDataPoll(M0P_UART0, sData); -#endif + if(gDebugChannel == DBG_CH_RS485_1) { + LPUart_SendData(M0P_LPUART0, sData); + } else { + Uart_SendDataPoll(M0P_UART0, sData); + } } void DBGUartSend(uint8_t *sData, int sLen) { -#if USE_BOOTLOADER - LPUart0SendArray(sData, sLen); -#else - for(int i = 0; i < sLen; i++) { - Uart_SendDataPoll(M0P_UART0, sData[i]); + if(gDebugChannel == DBG_CH_RS485_1) { + LPUart0SendArray(sData, sLen); + } else { + for(int i = 0; i < sLen; i++) { + Uart_SendDataPoll(M0P_UART0, sData[i]); + } } -#endif } void LPUart0SendArray(uint8_t *sData, uint8_t sLen) { @@ -805,7 +805,7 @@ void Uart0_IRQHandler(void) if(Uart_GetStatus(M0P_UART0, UartRC)) { /// Uart_ClrStatus(M0P_UART0, UartRC); ///<ж uint8_t u8RxData = Uart_ReceiveData(M0P_UART0); ///ȡ - //DebugUartIRQ(u8RxData); + DebugUartIRQ(u8RxData); } }