fix: 修复串口调试DCH通道切换无效及UART0无法接收调试指令的问题
1. DBGUartSend/DBGUartSendByte改为运行时通过gDebugChannel选择输出通道,替代编译期USE_BOOTLOADER宏 2. 启用Uart0_IRQHandler中的DebugUartIRQ调用,使UART0可接收调试指令
This commit is contained in:
+7
-7
@@ -703,21 +703,21 @@ void PrintfMess(void)
|
|||||||
}
|
}
|
||||||
void DBGUartSendByte(uint8_t sData)
|
void DBGUartSendByte(uint8_t sData)
|
||||||
{
|
{
|
||||||
#if USE_BOOTLOADER
|
if(gDebugChannel == DBG_CH_RS485_1) {
|
||||||
LPUart_SendData(M0P_LPUART0, sData);
|
LPUart_SendData(M0P_LPUART0, sData);
|
||||||
#else
|
} else {
|
||||||
Uart_SendDataPoll(M0P_UART0, sData);
|
Uart_SendDataPoll(M0P_UART0, sData);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
void DBGUartSend(uint8_t *sData, int sLen)
|
void DBGUartSend(uint8_t *sData, int sLen)
|
||||||
{
|
{
|
||||||
#if USE_BOOTLOADER
|
if(gDebugChannel == DBG_CH_RS485_1) {
|
||||||
LPUart0SendArray(sData, sLen);
|
LPUart0SendArray(sData, sLen);
|
||||||
#else
|
} else {
|
||||||
for(int i = 0; i < sLen; i++) {
|
for(int i = 0; i < sLen; i++) {
|
||||||
Uart_SendDataPoll(M0P_UART0, sData[i]);
|
Uart_SendDataPoll(M0P_UART0, sData[i]);
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
void LPUart0SendArray(uint8_t *sData, uint8_t sLen)
|
void LPUart0SendArray(uint8_t *sData, uint8_t sLen)
|
||||||
{
|
{
|
||||||
@@ -805,7 +805,7 @@ void Uart0_IRQHandler(void)
|
|||||||
if(Uart_GetStatus(M0P_UART0, UartRC)) { ///接收数据
|
if(Uart_GetStatus(M0P_UART0, UartRC)) { ///接收数据
|
||||||
Uart_ClrStatus(M0P_UART0, UartRC); ///<清接收中断请求
|
Uart_ClrStatus(M0P_UART0, UartRC); ///<清接收中断请求
|
||||||
uint8_t u8RxData = Uart_ReceiveData(M0P_UART0); ///读取数据
|
uint8_t u8RxData = Uart_ReceiveData(M0P_UART0); ///读取数据
|
||||||
//DebugUartIRQ(u8RxData);
|
DebugUartIRQ(u8RxData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user