LUFA Library
120219
|
Lightweight ring (circular) buffer, for fast insertion/deletion of bytes. More...
#include "../../Common/Common.h"
Data Structures | |
struct | RingBuffer_t |
Ring Buffer Management Structure. More... | |
Functions | |
static void | RingBuffer_InitBuffer (RingBuffer_t *Buffer, uint8_t *const DataPtr, const uint16_t Size) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) |
static uint16_t | RingBuffer_GetCount (RingBuffer_t *const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1) |
static uint16_t | RingBuffer_GetFreeCount (RingBuffer_t *const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1) |
static bool | RingBuffer_IsEmpty (RingBuffer_t *const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1) |
static bool | RingBuffer_IsFull (RingBuffer_t *const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1) |
static void | RingBuffer_Insert (RingBuffer_t *Buffer, const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1) |
static uint8_t | RingBuffer_Remove (RingBuffer_t *Buffer) ATTR_NON_NULL_PTR_ARG(1) |
static uint8_t | RingBuffer_Peek (RingBuffer_t *const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1) |
Lightweight ring buffer, for fast insertion/deletion. Multiple buffers can be created of different sizes to suit different needs.
Note that for each buffer, insertion and removal operations may occur at the same time (via a multi-threaded ISR based system) however the same kind of operation (two or more insertions or deletions) must not overlap. If there is possibility of two or more of the same kind of operating occurring at the same point in time, atomic (mutex) locking should be used.