From 1249920a6c7094f923e77f7d2131978e19604396 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 25 Sep 2021 01:12:18 +0200 Subject: arduino-nano stdout: add pprint (pgmspace string output) --- src/arch/arduino-nano/driver/stdout.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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 -#include #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(text); + char c; + while ((c = pgm_read_byte(p++))) { + put(c); + } + return *this; +} + void StandardOutput::put(char c) { while (!(UCSR0A & _BV(UDRE0))); -- cgit v1.2.3