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;
}