Skip to content
Snippets Groups Projects
Commit 38992c2a authored by Sandeep Mistry's avatar Sandeep Mistry Committed by Cristian Maglie
Browse files

Add availableForStore method to RingBuffer

parent a32ac8cd
Branches
Tags
No related merge requests found
......@@ -67,6 +67,14 @@ int RingBuffer::available()
return delta;
}
int RingBuffer::availableForStore()
{
if (_iHead >= _iTail)
return SERIAL_BUFFER_SIZE - 1 - _iHead + _iTail;
else
return _iTail - _iHead - 1;
}
int RingBuffer::peek()
{
if(_iTail == _iHead)
......
......@@ -40,6 +40,7 @@ class RingBuffer
void clear();
int read_char();
int available();
int availableForStore();
int peek();
bool isFull();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment