Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5e21320

Browse files
committed
Import AVR implementation for print(F())
1 parent8b5b3fe commit5e21320

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎api/Print.cpp‎

Lines changed: 12 additions & 0 deletions
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_tPrint::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+
unsignedchar c =pgm_read_byte(p++);
46+
if (c ==0)break;
47+
if (write(c)) n++;
48+
elsebreak;
49+
}
50+
return n;
51+
#else
4152
returnprint(reinterpret_cast<constchar *>(ifsh));
53+
#endif
4254
}
4355

4456
size_tPrint::print(const String &s)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp