Support C-style flash layer writes
This change adds a void* with length overload of the FlashMemory::Write
function to provide compatibility with traditional code.
Change-Id: I62f6028ce42112d0a82defecf2b388fa81f03e29
diff --git a/pw_kvs/public/pw_kvs/flash_memory.h b/pw_kvs/public/pw_kvs/flash_memory.h
index 0460922..ebd3dcd 100644
--- a/pw_kvs/public/pw_kvs/flash_memory.h
+++ b/pw_kvs/public/pw_kvs/flash_memory.h
@@ -89,6 +89,13 @@
virtual StatusWithSize Write(Address destination_flash_address,
span<const std::byte> data) = 0;
+ StatusWithSize Write(Address destination_flash_address,
+ const void* data,
+ size_t len) {
+ return Write(destination_flash_address,
+ span(static_cast<const std::byte*>(data), len));
+ }
+
// Convert an Address to an MCU pointer, this can be used for memory
// mapped reads. Return NULL if the memory is not memory mapped.
virtual std::byte* FlashAddressToMcuAddress(Address) const { return nullptr; }