PL::ModbusMemoryArea class
-
class ModbusMemoryArea : public PL::Buffer
Modbus memory area.
Subclassed by PL::ModbusTypedMemoryArea< Type >
Public Functions
-
ModbusMemoryArea(ModbusMemoryType type, uint16_t address, size_t size)
Creates a Modbus memory area and allocates memory.
- Parameters:
type – memory area type
address – memory area address
size – memory area data size (in bytes)
-
ModbusMemoryArea(ModbusMemoryType type, uint16_t address, void *data, size_t size)
Creates a Modbus memory area from preallocated memory.
- Parameters:
type – memory area type
address – memory area address
data – memory area data pointer
size – memory area data size (in bytes)
Creates a Modbus memory area from preallocated memory with shared lockable.
- Parameters:
type – memory area type
address – memory area address
data – memory area data pointer
size – memory area data size (in bytes)
lockable – lockable object that is locked when this memory area is locked
-
virtual esp_err_t OnRead()
Callback method that is called when memory area is about to be read.
-
virtual esp_err_t OnWrite()
Callback method that is called when memory area has just been written.
-
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.
-
ModbusMemoryArea(ModbusMemoryType type, uint16_t address, size_t size)