1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #1650 from kaspar030/ringbuffer_get_free

sys: lib: ringbuffer: introduce ringbuffer_get_free
This commit is contained in:
Kaspar Schleiser 2014-10-22 17:24:13 +02:00
commit ce6659a192

View File

@ -106,6 +106,16 @@ static inline int ringbuffer_full(const ringbuffer_t *restrict rb)
return rb->avail == rb->size;
}
/**
* @brief Return available space in ringbuffer
* @param[in,out] rb Ringbuffer to query.
* @returns number of available bytes
*/
static inline unsigned int ringbuffer_get_free(const ringbuffer_t *restrict rb)
{
return rb->size - rb->avail;
}
/**
* @brief Read, but don't remove, the oldest element in the buffer.
* @param[in] rb Ringbuffer to operate on.