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 --- KSingleLineBus/SLP.h | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 42 insertions(+), 8 deletions(-) diff --git a/KSingleLineBus/SLP.h b/KSingleLineBus/SLP.h index 9324d44..bb2c85a 100644 --- a/KSingleLineBus/SLP.h +++ b/KSingleLineBus/SLP.h @@ -19,14 +19,48 @@ // uchar ED; }stSLPPacket; -extern uchar bSLPMaster; -extern uchar nStation; -extern uchar SLPinputB; -extern uchar SLPoutputB; -extern uchar SLPErrSign; +//extern uchar bSLPMaster; +//extern uchar nStation; +//extern uchar SLPinputB; +//extern uchar SLPoutputB; +//extern uchar SLPErrSign; -void SLPparsePacket(char * pBuf, uchar len1); -void SLPMasterSendPacket(void); -void SLPProcess(void); +typedef void (*SLPSendPktDef)(char * pBuf, int Len1); + + +typedef struct tagSLPDef +{ + uchar bSLPMaster; + uchar nStation; + uchar SLPinputB; + uchar SLPoutputB; + uchar nCurStation; + uchar inputBuf[5]; + uchar outputBuf[5]; + + uchar SendBuf[8]; + + uchar SLPMasterRecved; //主机收到子机回复 + + SLPSendPktDef SLPSendPktFunc; + + unsigned int SLPSlaveCountOut; + + unsigned int SLPLostPkt; // 丢包数量 + + uchar SLPOKSign; + uchar SLPErrSign; + + int nCount; + +}stSLPDef; + +void SLPInit(stSLPDef * pSLP, SLPSendPktDef pFunc1); +void SLPSetCallBack(stSLPDef * pSLP, SLPSendPktDef pFunc1); + +void SLPparsePacket(stSLPDef * pSLP, char * pBuf, uchar len1); +void SLPMasterSendPacket(stSLPDef * pSLP); +void SLPProcess(stSLPDef * pSLP); + #endif /* __SLP_H_V10__ */ \ No newline at end of file -- Gitblit v1.9.1