Implemented basic example showing flash string

This commit is contained in:
BlackMark 2019-07-27 13:34:30 +02:00
parent daa7d6c2c1
commit 5b82e2d629
2 changed files with 23 additions and 1 deletions

@ -1 +1 @@
Subproject commit 1bf2a07bc31e8de852f308cadbf7f5269e6551c6
Subproject commit b0f602b3be5608d71a401f5c75609f09e92df4a9

View File

@ -1,6 +1,28 @@
#include <stddef.h>
#include "flash/flash.hpp"
size_t getSize(const detail::FlashString *flashString)
{
size_t size = 0;
while (true) {
char ch = pgm_read_byte(reinterpret_cast<const char *>(flashString) + size);
if (ch == '\0')
break;
++size;
}
return size;
}
int main()
{
auto flashString = F("Hello World!");
getSize(flashString);
return 0;
}