|
@@ -133,6 +133,7 @@ uint32_t read_ringBuffer(uint8_t *buffer, uint32_t size, ringbuffer_t *ringBuf)
|
|
|
|
|
|
return size;
|
|
|
}
|
|
|
+
|
|
|
Std_ReturnType UART_Query_Data(uint8 transChannel, uint8 recvChannel, uint8 *txBuffer, uint16 sendLength, uint8 *rxBuffer, uint16 *rxlen, uint32 T_timeout)
|
|
|
{
|
|
|
UartMsg_t UartRecvMsg;
|
|
@@ -144,6 +145,7 @@ Std_ReturnType UART_Query_Data(uint8 transChannel, uint8 recvChannel, uint8 *txB
|
|
|
UartSendMsg.dataPtr = txBuffer;
|
|
|
*rxlen = 0;
|
|
|
Sendret = xQueueSend(UartSendQueue[transChannel], &UartSendMsg, 50);
|
|
|
+
|
|
|
if (Sendret == pdTRUE)
|
|
|
{
|
|
|
Recvret = xQueueReceive(UartRecvQueue[recvChannel], &UartRecvMsg, T_timeout);
|
|
@@ -215,7 +217,7 @@ void UartInit(void)
|
|
|
UartSendQueue[2] = xQueueCreate(1, sizeof(UartMsg_t));
|
|
|
UartHalQueueHandle = xQueueCreate(9, sizeof(UartHalMsg_t));
|
|
|
|
|
|
- xTaskCreate(Uart_Hal_RecvTask, (const char *const)"UartRecv", 256, (void *)0, main_TASK_PRIORITY + 5, NULL);
|
|
|
+ xTaskCreate(Uart_Hal_RecvTask, (const char *const)"UartRecv", 512, (void *)0, main_TASK_PRIORITY + 5, NULL);
|
|
|
xTaskCreate(Uart_Hal_SendTask, (const char *const)"UartSend", 256, (void *)0, main_TASK_PRIORITY + 4, NULL);
|
|
|
}
|
|
|
Std_ReturnType UartStartRecvFunc(uint8 channel)
|
|
@@ -271,10 +273,7 @@ void Uart_Hal_RecvTask(void *pvParameters)
|
|
|
{
|
|
|
UartState[UartIdx] = UartRecvComplete;
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ else{}
|
|
|
|
|
|
if ((UartState[UartIdx] == UartAbortRecv) || (UartState[UartIdx] == UartRecvComplete)) //判定UART开始接收:UART停止后开始接收
|
|
|
{
|
|
@@ -298,10 +297,6 @@ void Uart_Hal_RecvTask(void *pvParameters)
|
|
|
UartRecvMsg.dataAddr = (uint32)(uartRingBuffer[UartHalMsgRecv.Channel].bw + uartRingBuffer[UartHalMsgRecv.Channel].source - UartHalMsgRecv.value);
|
|
|
ret_send = xQueueSend(UartRecvQueue[UartHalMsgRecv.Channel], &UartRecvMsg, 10);
|
|
|
}
|
|
|
-#if SEGGER_PRINTF==1
|
|
|
- if(UartHalMsgRecv.Channel == 0X01)
|
|
|
- SEGGER_RTT_printf("send cmd and receive [%d]:{ %s }\r\n",UartRecvMsg.DataLen,UartRecvMsg.dataAddr);
|
|
|
-#endif
|
|
|
T_timeout[UartHalMsgRecv.Channel] = 0;
|
|
|
UartState[UartHalMsgRecv.Channel] = UartRecvComplete;
|
|
|
}
|
|
@@ -323,25 +318,7 @@ void Uart_Hal_SendTask(void *pvParameters)
|
|
|
|
|
|
if (ret == pdTRUE)
|
|
|
{
|
|
|
- if(2 == UartIdx)
|
|
|
- {
|
|
|
-#if 1
|
|
|
- SEGGER_RTT_printf("ble rec:%s\r\n", UartSendMsg.dataPtr);
|
|
|
-#endif
|
|
|
- }
|
|
|
-
|
|
|
-#if SEGGER_PRINTF==1
|
|
|
- if(UartIdx==1 && UartSendMsg.dataPtr==0x1FFF3BD4)
|
|
|
- {
|
|
|
- SEGGER_RTT_printf("send [%d]:{ %X }\r\n",UartSendMsg.DataLen,UartSendMsg.dataPtr);
|
|
|
- for(uint8 i=0;i<UartSendMsg.DataLen;i++)
|
|
|
- {
|
|
|
- SEGGER_RTT_printf("%02X ",*(UartSendMsg.dataPtr+i));
|
|
|
- }
|
|
|
- SEGGER_RTT_printf("\r\n");
|
|
|
- SEGGER_RTT_printf("send [%d]:{ %s }\r\n",UartSendMsg.DataLen,UartSendMsg.dataPtr);
|
|
|
- }
|
|
|
-#endif
|
|
|
+
|
|
|
T_Uart_Status[UartIdx] = Uart_AsyncSend(UartIdx, UartSendMsg.dataPtr, UartSendMsg.DataLen);
|
|
|
if (E_OK != T_Uart_Status[UartIdx])
|
|
|
{
|