From 842bb64195f958b050867c50db66fc0aa413dafb Mon Sep 17 00:00:00 2001
From: QuakeGod <quakegod@sina.com>
Date: 星期六, 27 七月 2024 10:42:56 +0800
Subject: [PATCH] KBus upgrade

---
 KMini_CCT6/Src/functions.c |   66 ++++++++++++++++++++-------------
 1 files changed, 40 insertions(+), 26 deletions(-)

diff --git a/KMini_CCT6/Src/functions.c b/KMini_CCT6/Src/functions.c
index c9a13d1..e865344 100644
--- a/KMini_CCT6/Src/functions.c
+++ b/KMini_CCT6/Src/functions.c
@@ -13,15 +13,22 @@
 #endif
 extern __IO uint32_t uwTick;
 
-unsigned char Uart5RxBuf[RX5BUFSIZE];
-unsigned char Uart5TxBuf[TX5BUFSIZE];
+unsigned char Uart3RxBuf[UART3RXBUFSIZE];
+unsigned char Uart3TxBuf[UART3TXBUFSIZE];
+stUartStat Uart3Stat={0};
+unsigned int Uart3RecvBuf1DataLen =0;
+unsigned int Uart3ToSendLen =0 ;
+unsigned int Uart3SentLen = 0;
+
+unsigned char Uart5RxBuf[UART5RXBUFSIZE];
+unsigned char Uart5TxBuf[UART5TXBUFSIZE];
 stUartStat Uart5Stat={0};
 unsigned int Uart5RecvBuf1DataLen =0;
 unsigned int Uart5ToSendLen =0 ;
 unsigned int Uart5SentLen = 0;
 
-unsigned char Uart6RxBuf[RX6BUFSIZE];
-unsigned char Uart6TxBuf[TX6BUFSIZE];
+unsigned char Uart6RxBuf[UART6RXBUFSIZE];
+unsigned char Uart6TxBuf[UART6TXBUFSIZE];
 stUartStat Uart6Stat={0};
 unsigned int Uart6RecvBuf1DataLen =0;
 unsigned int Uart6ToSendLen =0 ;
@@ -312,25 +319,6 @@
 	  SCB->ICSR=SCB_ICSR_PENDSVSET_Msk; //1<<SCB_ICSR_PENDSVSET_Pos;
 }
 
-void PendSvCallBack()
-{
-#if (BOARD_TYPE == 14)
-///*	
-		if (bSPI1RecvDone)
-		{
-			bSPI1RecvDone=0;
-			ParseFP0Pkg(SPI1RecvBuf,nSPI1RecvLenInBuf);
-		}
-//*/	
-#endif		
-	if (Uart2Stat.bPacketRecved)
-	{
-		KBusParsePacket(2, (pKBPacket)Uart2RecvBuf1, Uart2RecvBuf1DataLen);		
-		Uart2RecvBuf1DataLen=0;
-		Uart2Stat.bPacketRecved=0;
-		Uart2RecvDMA(Uart2RecvBuf1,sizeof(Uart2RecvBuf1));		
-	}
-}
 
 void SPI1_IRQ_CallBack()
 {
@@ -359,7 +347,6 @@
 				 bSPI1RecvDone=1;
 				 nSPI1RecvPos=0;
 				 bSPI1Recving=0;
-				 
 			 
 				 TriggerPendSV();
 			 }
@@ -426,6 +413,33 @@
 	//	ParsePacket((pKBPacket)Uart2RecvBuf1,Uart2RecvBuf1DataLen);
 }
 
+void Uart3SendDone()
+{
+//	Uart1Stat.TcCount++;
+	return;
+}
+
+void Uart3RecvDone()
+{
+//		Uart3Stat.IdelCount++;
+//		NVIC_SetPendingIRQ(PendSV_IRQn);
+//	  SCB->ICSR=SCB_ICSR_PENDSVSET_Msk; //1<<SCB_ICSR_PENDSVSET_Pos;
+	
+	if (Uart3RecvBuf1DataLen >0)
+	{
+		Uart3Stat.bPacketRecved=1;
+//	  SCB->ICSR=SCB_ICSR_PENDSVSET_Msk; //1<<SCB_ICSR_PENDSVSET_Pos;
+//		KLParsePacket(Uart1RecvBuf1,Uart1RecvBuf1DataLen);
+//		Uart1RecvBuf1DataLen=0;
+	}
+}
+void Uart3SendPacket(char * str, int len)
+{
+	memcpy(Uart3TxBuf,str,len);
+	Uart3ToSendLen = len;
+	LL_USART_EnableIT_TXE(USART3);
+}
+
 void Uart5SendDone()
 {
 //	Uart1Stat.TcCount++;
@@ -474,7 +488,7 @@
 //		Uart1RecvBuf1DataLen=0;
 	}
 }
-void Uart6SendPacket(char * str, int len)
+void Uart6SendPacket(unsigned char * str, int len)
 {
 	memcpy(Uart6TxBuf,str,len);
 	Uart6ToSendLen = len;
@@ -482,7 +496,7 @@
 	LL_USART_EnableIT_TXE(USART6);
 }
 
-void SLPSendPacket(char * str, uchar len)
+void SLPSendPacket(void * str, uchar len)
 {
 	Uart6SendPacket(str,len);
 }

--
Gitblit v1.9.1