84 #define Q_INIT(NAME, ENTRY_SIZE, CAPACITY) \
85 static uint8_t NAME ## Mem[ ( ENTRY_SIZE ) * ( CAPACITY ) ]; \
86 static const QueueDescr NAME ## Descr = { \
87 .memoryFirst = NAME ## Mem, \
88 .memoryLast = NAME ## Mem + ((CAPACITY) - 1) * ( ENTRY_SIZE ), \
89 .capacity = CAPACITY, \
90 .entrySize = ENTRY_SIZE \
92 static Queue NAME = { \
93 .descr = &NAME ## Descr, \
95 .readPtr = NAME ## Mem, \
96 .writePtr = NAME ## Mem \
128 if (target == NULL)
return false;
177 if (source == NULL)
return false;
240 return ptr == q->
writePtr ? NULL : ptr;
const uint16_t entrySize
size of an entry
const uint16_t capacity
capacity in entries
static bool qFull(Queue *q)
Returns whether or not the queue is full.
static void * qNext(Queue *q, void *ptr)
Peek at the next element in the queue.
uint16_t length
length of the queue
const QueueDescr *const descr
pointer to the descriptor
void * writePtr
write pointer
void * readPtr
read pointer
void *const memoryFirst
first element pointer
bool qContains(Queue *q, void *data)
Iterates the queue to check for an element.
static void * qFirst(Queue *q)
Peek at the first element in the queue.
bool qRemoveBack(Queue *q)
Delete element from the back for the queue.
static bool qDeQueue(Queue *q, void *data)
Dequeue an element from the front of the queue.
void * qQueueIP(Queue *q)
Queue data to the end of the queue in place.
static bool qQueue(Queue *q, void *data)
Queue data to the end of the queue.
static void qReset(Queue *q)
Resets the queue.
void * qDeQueueIP(Queue *q)
Dequeue an element from the front of the queue in place.
void *const memoryLast
last element pointer