summaryrefslogtreecommitdiff
path: root/include/esp8266
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-12-08 15:24:37 +0100
committerDaniel Friesel <derf@finalrewind.org>2017-12-08 15:24:37 +0100
commit540974f8f109aa8874f032eddf59819c76eb018e (patch)
tree00166d053f03dad76149c62fc57347fc2859a773 /include/esp8266
parentdcf84169ae75b11c1656d45dbc6c626d93da6a10 (diff)
"Fix" esp8266 UART output by removing virtual functions
Diffstat (limited to 'include/esp8266')
-rw-r--r--include/esp8266/driver/stdout.h51
1 files changed, 45 insertions, 6 deletions
diff --git a/include/esp8266/driver/stdout.h b/include/esp8266/driver/stdout.h
index 9114501..e3d6baa 100644
--- a/include/esp8266/driver/stdout.h
+++ b/include/esp8266/driver/stdout.h
@@ -1,20 +1,59 @@
#ifndef STANDARDOUTPUT_H
#define STANDANDOUTPUT_H
-#include "object/outputstream.h"
-
-class StandardOutput : public OutputStream {
+class StandardOutput {
private:
StandardOutput(const StandardOutput &copy);
+ char digit_buffer[sizeof(long long) * 8];
+ unsigned char base;
public:
- StandardOutput () {}
+ StandardOutput ();
void setup();
- virtual void put(char c) override;
- virtual void write(const char *s) override;
+ void put(char c);
+ void write(const char *s);
+ void flush() {}
+
+ StandardOutput & operator<<(char c);
+ StandardOutput & operator<<(unsigned char c);
+ StandardOutput & operator<<(unsigned short number);
+ StandardOutput & operator<<(short number);
+ StandardOutput & operator<<(unsigned int number);
+ StandardOutput & operator<<(int number);
+ StandardOutput & operator<<(unsigned long number);
+ StandardOutput & operator<<(long number);
+ StandardOutput & operator<<(unsigned long long number);
+ StandardOutput & operator<<(long long number);
+ StandardOutput & operator<<(void *pointer);
+ StandardOutput & operator<<(const char *text);
+ StandardOutput & operator<<(StandardOutput & (*fun) (StandardOutput &));
+
+ void setBase(unsigned char b);
};
+
+// ENDL: new line character (and flush)
+StandardOutput & endl(StandardOutput & os);
+
+// BIN: print numbers in binary form.
+StandardOutput & bin(StandardOutput & os);
+
+// OCT: print numbers in octal form.
+StandardOutput & oct(StandardOutput & os);
+
+// DEC: print numbers in decimal form.
+StandardOutput & dec(StandardOutput & os);
+
+// HEX: print numbers in hexadecimal form.
+StandardOutput & hex(StandardOutput & os);
+
+// FLUSH: flush StandardOutput buffer
+StandardOutput & flush(StandardOutput & os);
+
+// TERM: zero-termination
+StandardOutput & term(StandardOutput & os);
+
extern StandardOutput kout;
#endif