AP_HAL/utility: clear added to RingBuffer

This commit is contained in:
Eugene Shamaev 2017-04-02 17:54:46 +03:00 committed by Francisco Ferreira
parent a07033f938
commit d1792689f1
1 changed files with 12 additions and 0 deletions

View File

@ -104,6 +104,12 @@ public:
delete buffer; delete buffer;
} }
// Discards the buffer content, emptying it.
void clear(void)
{
buffer->clear();
}
// return number of objects available to be read // return number of objects available to be read
uint32_t available(void) const { uint32_t available(void) const {
return buffer->available() / sizeof(T); return buffer->available() / sizeof(T);
@ -229,6 +235,12 @@ public:
return true; return true;
} }
// Discards the buffer content, emptying it.
void clear(void)
{
head = count = 0;
}
/* /*
pop earliest object off the queue pop earliest object off the queue
*/ */