28 template <
class ITEM_TYPE,
int16_t BUFFER_SIZE>
41 return end == start && e_msb != s_msb;
46 return end == start && e_msb == s_msb;
50 void write(ITEM_TYPE in) {
58 ITEM_TYPE out = items[start];
64 unsigned long count() {
65 return (num_buffers_read << COUNT_LSHIFT) + start;
68 ITEM_TYPE * address() {
73 ITEM_TYPE items[BUFFER_SIZE];
78 unsigned long num_buffers_read;
79 static constexpr
unsigned long COUNT_LSHIFT =
80 (BUFFER_SIZE == 256) ? 8 :
81 (BUFFER_SIZE == 128) ? 7 :
82 (BUFFER_SIZE == 64) ? 6 :
83 (BUFFER_SIZE == 32) ? 5 :
84 (BUFFER_SIZE == 16) ? 4 :
85 (BUFFER_SIZE == 8) ? 3 :
86 (BUFFER_SIZE == 4) ? 2 :
87 (BUFFER_SIZE == 2) ? 1 : 0;
92 if (start == BUFFER_SIZE)
104 if (end == BUFFER_SIZE)
121 template <
class ITEM_TYPE>
133 return end == start && e_msb != s_msb;
138 return end == start && e_msb == s_msb;
142 void write(ITEM_TYPE in) {
150 ITEM_TYPE out = items[start];
156 unsigned long count() {
157 return (num_buffers_read << 8) + start;
160 ITEM_TYPE * address() {
165 ITEM_TYPE items[256];
170 unsigned long num_buffers_read;
185 if (end == 0) e_msb ^= 1;
CircularBuffer()
Constructor.
CircularBuffer()
Constructor.