From 9aed5d7e7b3c7bf09da712e9c272ece401a7acc9 Mon Sep 17 00:00:00 2001 From: QuakeGod <QuakeGod@sina.com> Date: 星期一, 25 十一月 2024 14:51:23 +0800 Subject: [PATCH] add UltraSonic and MultiWireLess --- ComLib/Inc/MyQueue.h | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ComLib/Inc/MyQueue.h b/ComLib/Inc/MyQueue.h index f070997..2b829b8 100644 --- a/ComLib/Inc/MyQueue.h +++ b/ComLib/Inc/MyQueue.h @@ -8,17 +8,22 @@ #ifndef __MYQUEUE_H__ #define __MYQUEUE_H__ +#pragma anon_unions typedef struct { unsigned char * buf1; - int Caps; - volatile int wp; //Write Pointor - volatile int rp; //Read Pointor + short Caps; + volatile short wp; //Write Pointor + volatile short rp; //Read Pointor // volatile int DataSize; - volatile int RecvBytes; - volatile int bFull; - volatile int bEmpty; - volatile int state; +// volatile short RecvBytes; + union{ + volatile unsigned char state; + struct{ + volatile unsigned char bFull:1; + volatile unsigned char bEmpty:1; + }; + }; }stMyQueue,* pMyQueue; @@ -30,7 +35,7 @@ } static __inline int GetDataLen(pMyQueue theQueue) { - int size=theQueue->wp -theQueue->rp; + int size=theQueue->wp - theQueue->rp; if (theQueue->bFull) { return theQueue->Caps; -- Gitblit v1.9.1