mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-23 03:00:56 +00:00
wip - make ble come back after sleep
This commit is contained in:
20
lib/BluetoothOTA/src/SimpleAllocator.cpp
Normal file
20
lib/BluetoothOTA/src/SimpleAllocator.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "SimpleAllocator.h"
|
||||
#include "assert.h"
|
||||
|
||||
SimpleAllocator::SimpleAllocator() { reset(); }
|
||||
|
||||
void *SimpleAllocator::alloc(size_t size)
|
||||
{
|
||||
assert(nextFree + size <= sizeof(bytes));
|
||||
void *res = &bytes[nextFree];
|
||||
nextFree += size;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void SimpleAllocator::reset() { nextFree = 0; }
|
||||
|
||||
void *operator new(size_t size, SimpleAllocator &p)
|
||||
{
|
||||
return p.alloc(size);
|
||||
}
|
||||
Reference in New Issue
Block a user