massive WIP updates to create a clean Router abstraction for mesh

This commit is contained in:
geeksville
2020-04-17 09:48:54 -07:00
parent 6eb74415ab
commit f108c576a7
18 changed files with 303 additions and 146 deletions

View File

@@ -31,6 +31,7 @@ template <class T> class MemoryPool
~MemoryPool() { delete[] buf; }
/// Return a queable object which has been prefilled with zeros. Panic if no buffer is available
/// Note: this method is safe to call from regular OR ISR code
T *allocZeroed()
{
T *p = allocZeroed(0);
@@ -40,7 +41,7 @@ template <class T> class MemoryPool
}
/// Return a queable object which has been prefilled with zeros - allow timeout to wait for available buffers (you probably
/// don't want this version)
/// don't want this version).
T *allocZeroed(TickType_t maxWait)
{
T *p = dead.dequeuePtr(maxWait);
@@ -65,7 +66,7 @@ template <class T> class MemoryPool
{
assert(dead.enqueue(p, 0));
assert(p >= buf &&
(size_t) (p - buf) <
(size_t)(p - buf) <
maxElements); // sanity check to make sure a programmer didn't free something that didn't come from this pool
}
@@ -74,7 +75,7 @@ template <class T> class MemoryPool
{
assert(dead.enqueueFromISR(p, higherPriWoken));
assert(p >= buf &&
(size_t) (p - buf) <
(size_t)(p - buf) <
maxElements); // sanity check to make sure a programmer didn't free something that didn't come from this pool
}
};