diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-01-02 11:17:30 +0000 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2017-05-16 14:52:47 +0200 |
commit | 716fba8dd98f54dcd816fa69cafdcb681b54ab11 (patch) | |
tree | ab2a17a984cab2f780500ee1befef15ebd245eca /cores/arduino/Print.h | |
parent | 2a4e2b968f4eab9cf2b2b8e72a8583ac41328af9 (diff) |
Add Print::availableForWrite
If available() is in the base Stream class, then availableForWrite() should be in the base Print class
Diffstat (limited to 'cores/arduino/Print.h')
-rw-r--r-- | cores/arduino/Print.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cores/arduino/Print.h b/cores/arduino/Print.h index d099a3b..4d8a2f5 100644 --- a/cores/arduino/Print.h +++ b/cores/arduino/Print.h @@ -22,6 +22,7 @@ #include <inttypes.h> #include <stdio.h> // for size_t +#include <limits.h> // for INT_MAX #include "WString.h" #include "Printable.h" @@ -57,7 +58,11 @@ class Print size_t write(const char *buffer, size_t size) { return write((const uint8_t *)buffer, size); } - + + // default to zero, meaning "a single write may block" + // should be overriden by subclasses with buffering + virtual int availableForWrite() { return 0; } + size_t print(const __FlashStringHelper *); size_t print(const String &); size_t print(const char[]); |