mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
parent
fb8e439f3b
commit
44b5096e05
@ -41,7 +41,7 @@ size_t Print::write(const uint8_t *buffer, size_t size)
|
||||
|
||||
size_t Print::print(const __FlashStringHelper *ifsh)
|
||||
{
|
||||
const char PROGMEM *p = (const char PROGMEM *)ifsh;
|
||||
PGM_P p = reinterpret_cast<PGM_P>(ifsh);
|
||||
size_t n = 0;
|
||||
while (1) {
|
||||
unsigned char c = pgm_read_byte(p++);
|
||||
@ -53,11 +53,7 @@ size_t Print::print(const __FlashStringHelper *ifsh)
|
||||
|
||||
size_t Print::print(const String &s)
|
||||
{
|
||||
size_t n = 0;
|
||||
for (uint16_t i = 0; i < s.length(); i++) {
|
||||
n += write(s[i]);
|
||||
}
|
||||
return n;
|
||||
return write(s.c_str(), s.length());
|
||||
}
|
||||
|
||||
size_t Print::print(const char str[])
|
||||
|
@ -51,6 +51,9 @@ class Print
|
||||
return write((const uint8_t *)str, strlen(str));
|
||||
}
|
||||
virtual size_t write(const uint8_t *buffer, size_t size);
|
||||
size_t write(const char *buffer, size_t size) {
|
||||
return write((const uint8_t *)buffer, size);
|
||||
}
|
||||
|
||||
size_t print(const __FlashStringHelper *);
|
||||
size_t print(const String &);
|
||||
|
Loading…
x
Reference in New Issue
Block a user