diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-07-17 09:57:10 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-07-17 09:57:10 +0200 |
commit | 3fddb519f01ca53f1fd6f5c24e154912b25d1138 (patch) | |
tree | 62efb5ea5431f543f0ea899aa809e262e47980ba /include/arch/esp8266/driver/stdout.h | |
parent | 658ca283452c5944c55d9c751868eef6c6f34138 (diff) |
Move include/$arch to include/arch/$arch to be consistent with src/ hierarchy
Diffstat (limited to 'include/arch/esp8266/driver/stdout.h')
-rw-r--r-- | include/arch/esp8266/driver/stdout.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/include/arch/esp8266/driver/stdout.h b/include/arch/esp8266/driver/stdout.h new file mode 100644 index 0000000..038de2e --- /dev/null +++ b/include/arch/esp8266/driver/stdout.h @@ -0,0 +1,61 @@ +#ifndef STANDARDOUTPUT_H +#define STANDARDOUTPUT_H + +class StandardOutput { + private: + StandardOutput(const StandardOutput ©); + char digit_buffer[sizeof(long long) * 8]; + unsigned char base; + + public: + StandardOutput (); + void setup(); + + void put(char c); + void write(const char *s); + void flush() {} + void printf_uint8(unsigned char num); + void printf_float(float num); + + 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 |