From 5b82e2d62957f1d9bfd428624b4eebcf5e7fe6b2 Mon Sep 17 00:00:00 2001 From: BlackMark Date: Sat, 27 Jul 2019 13:34:30 +0200 Subject: [PATCH] Implemented basic example showing flash string --- flash/flash | 2 +- flash/main.cpp | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/flash/flash b/flash/flash index 1bf2a07..b0f602b 160000 --- a/flash/flash +++ b/flash/flash @@ -1 +1 @@ -Subproject commit 1bf2a07bc31e8de852f308cadbf7f5269e6551c6 +Subproject commit b0f602b3be5608d71a401f5c75609f09e92df4a9 diff --git a/flash/main.cpp b/flash/main.cpp index 291a1d9..8a7fc3b 100644 --- a/flash/main.cpp +++ b/flash/main.cpp @@ -1,6 +1,28 @@ +#include + #include "flash/flash.hpp" +size_t getSize(const detail::FlashString *flashString) +{ + size_t size = 0; + + while (true) { + char ch = pgm_read_byte(reinterpret_cast(flashString) + size); + + if (ch == '\0') + break; + + ++size; + } + + return size; +} + int main() { + auto flashString = F("Hello World!"); + + getSize(flashString); + return 0; }