aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/Stream.h
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2013-12-30 10:58:03 -0800
committerCristian Maglie <c.maglie@bug.st>2013-12-30 10:58:03 -0800
commit15417bab95046fa7cf165eed886e71229c7b1384 (patch)
treeaf2c0322376a96d58d75fb7f16a90cdd1b793beb /cores/arduino/Stream.h
parentdce9146485869ed6008dce30777ffd08c1f92311 (diff)
parent94cf4c2830fd6fb639c4cdc4c2efe0d28f8bc6c1 (diff)
Merge pull request #1762 from matthijskooijman/ide-1.5.x-write-char
Support both char* and uint8* in Stream and Print
Diffstat (limited to 'cores/arduino/Stream.h')
-rw-r--r--cores/arduino/Stream.h6
1 files changed, 6 insertions, 0 deletions
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)