From a7db3c8485547ec1c6b07c59b2aacc4a45249cfa Mon Sep 17 00:00:00 2001
From: QuakeGod <QuakeGod@sina.com>
Date: 星期一, 17 十月 2022 01:50:48 +0800
Subject: [PATCH] arrange Klink Knet FP0 Radio and merge together

---
 Inc/KBus.h |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/Inc/KBus.h b/Inc/KBus.h
index 3e17746..3436a55 100644
--- a/Inc/KBus.h
+++ b/Inc/KBus.h
@@ -11,7 +11,7 @@
 #define __KBUS_H__
 typedef unsigned char uchar;
 
-extern int bMaster,bSlave;
+extern unsigned char bKBusMaster,bKBusSlave,bKBusRepeater;;
 	enum enCMDs
 	{
 		cmdNone = '0',		//Nothing
@@ -43,14 +43,15 @@
 
 extern unsigned char BufferIn[16];
 extern unsigned char BufferOut[16];
-extern int nAddr;
-extern int nChilds;
+extern unsigned char nAddr;
+extern unsigned char nChilds;
 extern int ChildStat[16];
-extern int nCurPollId;
-extern int nSeq;
+extern unsigned char nCurPollId;
+extern unsigned char nSeq;
 
-extern int MasterRecved;
-extern volatile int SlaveRecved;
+extern volatile unsigned char MasterRecved;
+extern volatile unsigned char MasterRecvOK;
+extern volatile unsigned char SlaveRecved;
 extern unsigned int SendTimeuS;
 extern volatile int RecvTimeuS;
 extern int DelayuS;
@@ -142,6 +143,7 @@
 		};
 	};
 } stChnStat;
+
 extern stChnStat ChnStats[8];
 
 typedef struct tagSlaveStat
@@ -189,7 +191,7 @@
 typedef struct tagPacket
 	{
 		unsigned char Sign;		//起始标记		
-		unsigned char DstAddr;	//目标地址
+		unsigned char DstHost;	//目标地址
 		unsigned char SrcAddr;	//源地址
 		unsigned char nCMD;		//命令
 		unsigned char nSEQ;		//序列号
@@ -204,20 +206,20 @@
 	S_TIMEOUT=2
 
 }	;
+
 unsigned char BCC(void * pData, int nSize);
 //
-
 	/* Make a Packet and return Packet Length */
 int MakePacket(pPacket p1,uchar Src, uchar Dst, uchar nType, uchar nSEQ, uchar DataLen, void *pData );
 
 /*   */
-int CheckPacket(pPacket p1,int len1);
+int CheckPacket(int nChn, pPacket p1, int len1);
 
 /* */
-int ParsePacket(pPacket p1, int Len1);
+int ParsePacket(int nChn, pPacket p1, int Len1);
 typedef struct tagMachineConfig
 {
-	int bMaster;
+	int bKBusMaster;
 	int nAddr;
 }stMachineConfig;
 
@@ -237,10 +239,9 @@
 
 int GetStat(void);
 
-
-
-	
-
+int KBusRepeaterFunc(int nChn);
+int KBusMasterFunc(int nChn);
+int KBusSlaveFunc(int nChn);
 
 #endif	/* __KBUS_H__ */
 

--
Gitblit v1.9.1