Skip to content

Commit 5e21320

Browse files
committed
Import AVR implementation for print(F())
1 parent 8b5b3fe commit 5e21320

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: api/Print.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,19 @@ size_t Print::write(const uint8_t *buffer, size_t size)
3838

3939
size_t Print::print(const __FlashStringHelper *ifsh)
4040
{
41+
#if defined(__AVR__)
42+
PGM_P p = reinterpret_cast<PGM_P>(ifsh);
43+
size_t n = 0;
44+
while (1) {
45+
unsigned char c = pgm_read_byte(p++);
46+
if (c == 0) break;
47+
if (write(c)) n++;
48+
else break;
49+
}
50+
return n;
51+
#else
4152
return print(reinterpret_cast<const char *>(ifsh));
53+
#endif
4254
}
4355

4456
size_t Print::print(const String &s)

0 commit comments

Comments
 (0)