mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-22 02:32:23 +00:00
mesh sending and receving now much more real
This commit is contained in:
21
src/PointerQueue.h
Normal file
21
src/PointerQueue.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "TypedQueue.h"
|
||||
|
||||
|
||||
/**
|
||||
* A wrapper for freertos queues that assumes each element is a pointer
|
||||
*/
|
||||
template <class T> class PointerQueue: public TypedQueue<T *> {
|
||||
public:
|
||||
PointerQueue(int maxElements) : TypedQueue<T *>(maxElements) {
|
||||
}
|
||||
|
||||
// preturns a ptr or null if the queue was empty
|
||||
T *dequeuePtr(TickType_t maxWait = portMAX_DELAY) {
|
||||
T *p;
|
||||
|
||||
return this->dequeue(&p, maxWait) == pdTRUE ? p : NULL;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user