|
-
May 2nd, 2010, 02:29 PM
#1
need help with circularbuffer warkmark level
I am treating a circular buffer like a buffer.
I have a situation that can occur in my design. I could receive 384 bytes into the circular buffer, and I only read 48 bytes. I don't want to keep turning on an off the RTS signal, for the validity of the checkWaterMarkLevel. I do this check after I have received data do not want to drop any data.
If you have better way of doing this let me know.
bool CircularBuffer::checkWaterMarkLevel()
{
bool waterMarkLevelcheck = false;
int waterMarkLevel;
waterMarkLevel = bufferSize/2;
if( writeCount - readCount >= waterMarkLevel)
{
waterMarkLevelcheck = false;
}
else
{
waterMarkLevelcheck = true;
}
return waterMarkLevelcheck;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|