aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino
diff options
context:
space:
mode:
Diffstat (limited to 'cores/arduino')
-rw-r--r--cores/arduino/Print.cpp4
-rw-r--r--cores/arduino/Print.h3
-rw-r--r--cores/arduino/Stream.h6
-rw-r--r--cores/arduino/WString.cpp4
4 files changed, 13 insertions, 4 deletions
diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp
index 38de93e..5df5630 100644
--- a/cores/arduino/Print.cpp
+++ b/cores/arduino/Print.cpp
@@ -41,7 +41,7 @@ size_t Print::write(const uint8_t *buffer, size_t size)
size_t Print::print(const __FlashStringHelper *ifsh)
{
- const char *p = reinterpret_cast<const char *>(ifsh);
+ PGM_P p = reinterpret_cast<PGM_P>(ifsh);
size_t n = 0;
while (1) {
unsigned char c = pgm_read_byte(p++);
@@ -53,7 +53,7 @@ size_t Print::print(const __FlashStringHelper *ifsh)
size_t Print::print(const String &s)
{
- return write(reinterpret_cast<const uint8_t*>(s.c_str()), s.length());
+ return write(s.c_str(), s.length());
}
size_t Print::print(const char str[])
diff --git a/cores/arduino/Print.h b/cores/arduino/Print.h
index dc76150..7b53aa4 100644
--- a/cores/arduino/Print.h
+++ b/cores/arduino/Print.h
@@ -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 &);
diff --git a/cores/arduino/Stream.h b/cores/arduino/Stream.h
index 007b4bc..5cf5ddf 100644
--- a/cores/arduino/Stream.h
+++ b/cores/arduino/Stream.h
@@ -57,14 +57,18 @@ class Stream : public Print
void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second
bool find(char *target); // reads data from the stream until the target string is found
+ bool find(uint8_t *target) { return find ((char *)target); }
// returns true if target string is found, false if timed out (see setTimeout)
bool find(char *target, size_t length); // reads data from the stream until the target string of given length is found
+ bool find(uint8_t *target, size_t length) { return find ((char *)target, length); }
// returns true if target string is found, false if timed out
bool findUntil(char *target, char *terminator); // as find but search ends if the terminator string is found
+ bool findUntil(uint8_t *target, char *terminator) { return findUntil((char *)target, terminator); }
bool findUntil(char *target, size_t targetLen, char *terminate, size_t termLen); // as above but search ends if the terminate string is found
+ bool findUntil(uint8_t *target, size_t targetLen, char *terminate, size_t termLen) {return findUntil((char *)target, targetLen, terminate, termLen); }
long parseInt(); // returns the first valid (long) integer value from the current position.
@@ -74,10 +78,12 @@ class Stream : public Print
float parseFloat(); // float version of parseInt
size_t readBytes( char *buffer, size_t length); // read chars from stream into buffer
+ size_t readBytes( uint8_t *buffer, size_t length) { return readBytes((char *)buffer, length); }
// terminates if length characters have been read or timeout (see setTimeout)
// returns the number of characters placed in the buffer (0 means no valid data found)
size_t readBytesUntil( char terminator, char *buffer, size_t length); // as readBytes with terminator character
+ size_t readBytesUntil( char terminator, uint8_t *buffer, size_t length) { return readBytesUntil(terminator, (char *)buffer, length); }
// terminates if length characters have been read, timeout, or if the terminator character detected
// returns the number of characters placed in the buffer (0 means no valid data found)
diff --git a/cores/arduino/WString.cpp b/cores/arduino/WString.cpp
index 63af6d3..8b6eabe 100644
--- a/cores/arduino/WString.cpp
+++ b/cores/arduino/WString.cpp
@@ -186,7 +186,7 @@ String & String::copy(const __FlashStringHelper *pstr, unsigned int length)
return *this;
}
len = length;
- strcpy_P(buffer, (const prog_char *)pstr);
+ strcpy_P(buffer, (PGM_P)pstr);
return *this;
}
@@ -246,7 +246,7 @@ String & String::operator = (const char *cstr)
String & String::operator = (const __FlashStringHelper *pstr)
{
- if (pstr) copy(pstr, strlen_P((const prog_char *)pstr));
+ if (pstr) copy(pstr, strlen_P((PGM_P)pstr));
else invalidate();
return *this;