diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-09-25 01:12:18 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-09-25 01:12:18 +0200 |
commit | 1249920a6c7094f923e77f7d2131978e19604396 (patch) | |
tree | 85396cd1895b892f321e88518df32459caef6190 /src/arch/arduino-nano | |
parent | 8578e1ea7d078b60864b084094dbb02b6cac99c3 (diff) |
arduino-nano stdout: add pprint (pgmspace string output)
Diffstat (limited to 'src/arch/arduino-nano')
-rw-r--r-- | src/arch/arduino-nano/driver/stdout.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/arch/arduino-nano/driver/stdout.cc b/src/arch/arduino-nano/driver/stdout.cc index f6c39b3..cddd499 100644 --- a/src/arch/arduino-nano/driver/stdout.cc +++ b/src/arch/arduino-nano/driver/stdout.cc @@ -5,7 +5,6 @@ */ #include "driver/stdout.h" #include <avr/io.h> -#include <avr/interrupt.h> #ifndef BAUD #define BAUD 9600UL @@ -28,6 +27,16 @@ void StandardOutput::setup() UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); } +OutputStream & StandardOutput::pprint(const char *text) +{ + PGM_P p = reinterpret_cast<PGM_P>(text); + char c; + while ((c = pgm_read_byte(p++))) { + put(c); + } + return *this; +} + void StandardOutput::put(char c) { while (!(UCSR0A & _BV(UDRE0))); |