Implemented basic example showing flash string
This commit is contained in:
1 parent
daa7d6c2c1
commit
5b82e2d629
2 files changed
+23
-1
No files matched your search
+1
-1
Submodule flash/flash updated: 1bf2a07bc3...b0f602b3be.
@@ -1,6 +1,28 @@
|
|||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "flash/flash.hpp"
|
#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()
|
int main()
|
||||||
{
|
{
|
||||||
|
auto flashString = F("Hello World!");
|
||||||
|
|
||||||
|
getSize(flashString);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user