9#ifndef CIRCULARBUFFER_H_
10#define CIRCULARBUFFER_H_
20template <
class T,
size_t MaxElements>
45 return (
head == (
tail + 1) % MaxElements);
Class that is implementing a circular buffer (for queue functionality).
Definition CircularBuffer.h:22
volatile uint16_t tail
Tail index of the circular buffer.
Definition CircularBuffer.h:26
T queue[MaxElements]
Array holding the circular buffer data.
Definition CircularBuffer.h:24
volatile uint16_t head
Head index of the circular buffer.
Definition CircularBuffer.h:25
T * dequeue()
Dequeue data from the queue and return a pointer to the data dequeue() should never be called on an e...
Definition CircularBuffer.h:64
void enqueue(T *data)
Enqueue the data at the given pointer into the queue.
Definition CircularBuffer.h:53
uint8_t empty()
Check if the circular buffer is empty.
Definition CircularBuffer.h:34
uint8_t full()
Check if the circular buffer is full.
Definition CircularBuffer.h:43