diff options
-rw-r--r-- | include/arch/esp8266/driver/stdout.h | 2 | ||||
-rw-r--r-- | src/arch/esp8266/driver/stdout.cc | 22 |
2 files changed, 8 insertions, 16 deletions
diff --git a/include/arch/esp8266/driver/stdout.h b/include/arch/esp8266/driver/stdout.h index 038de2e..95135ad 100644 --- a/include/arch/esp8266/driver/stdout.h +++ b/include/arch/esp8266/driver/stdout.h @@ -8,7 +8,7 @@ class StandardOutput { unsigned char base; public: - StandardOutput (); + StandardOutput() : base(10) {}; void setup(); void put(char c); diff --git a/src/arch/esp8266/driver/stdout.cc b/src/arch/esp8266/driver/stdout.cc index 2064b38..4471672 100644 --- a/src/arch/esp8266/driver/stdout.cc +++ b/src/arch/esp8266/driver/stdout.cc @@ -21,37 +21,37 @@ StandardOutput & StandardOutput::operator<<(char c) StandardOutput & StandardOutput::operator<<(unsigned short number) { - *this << (unsigned long long)number; + os_printf("%u", number); return *this; } StandardOutput & StandardOutput::operator<<(short number) { - *this << (long long)number; + os_printf("%d", number); return *this; } StandardOutput & StandardOutput::operator<<(unsigned int number) { - *this << (unsigned long long)number; + os_printf("%u", number); return *this; } StandardOutput & StandardOutput::operator<<(int number) { - *this << (long long)number; + os_printf("%d", number); return *this; } StandardOutput & StandardOutput::operator<<(unsigned long number) { - *this << (unsigned long long)number; + os_printf("%lu", number); return *this; } StandardOutput & StandardOutput::operator<<(long number) { - *this << (long long)number; + os_printf("%ld", number); return *this; } @@ -122,10 +122,7 @@ StandardOutput & StandardOutput::operator<<(void *pointer) StandardOutput & StandardOutput::operator<<(const char *text) { - int i = 0; - while (text[i] != '\0') { - put(text[i++]); - } + write(text); return *this; } @@ -227,11 +224,6 @@ StandardOutput & term(StandardOutput & os) return os; } -StandardOutput::StandardOutput() -{ - base = 10; -} - void StandardOutput::setup() { uart_div_modify(0, UART_CLK_FREQ / 115200); |