PL::Buffer class
-
class Buffer : public PL::Lockable
Lockable data buffer class.
Subclassed by PL::ModbusMemoryArea, PL::TypedBuffer< Type >
Public Functions
-
Buffer(size_t size)
Creates a buffer and allocates memory for its data.
- Parameters:
size – buffer data size
-
Buffer(void *data, size_t size)
Creates a buffer with preallocated data.
- Parameters:
data – buffer data pointer
size – buffer data size
Creates a buffer with preallocated data and shared lockable.
- Parameters:
data – buffer data pointer
size – buffer data size
lockable – lockable object that is locked when this buffer is locked
-
virtual esp_err_t Lock(TickType_t timeout = portMAX_DELAY) override
Locks the object.
- Parameters:
timeout – timeout in FreeRTOS ticks
- Returns:
error code
-
virtual esp_err_t Unlock() override
Unlocks the object.
- Returns:
error code
-
void Clear()
Sets all bytes of the buffer data to zero.
-
Buffer(size_t size)