summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/arch/arduino-nano/driver/stdout.h2
-rw-r--r--src/arch/arduino-nano/driver/stdout.cc11
2 files changed, 12 insertions, 1 deletions
diff --git a/include/arch/arduino-nano/driver/stdout.h b/include/arch/arduino-nano/driver/stdout.h
index eaf7eac..9f23fe3 100644
--- a/include/arch/arduino-nano/driver/stdout.h
+++ b/include/arch/arduino-nano/driver/stdout.h
@@ -6,6 +6,7 @@
#ifndef STANDARDOUTPUT_H
#define STANDARDOUTPUT_H
+#include <avr/pgmspace.h>
#include "object/outputstream.h"
class StandardOutput : public OutputStream {
@@ -17,6 +18,7 @@ class StandardOutput : public OutputStream {
void setup();
virtual void put(char c) override;
+ OutputStream & pprint(const char *text);
};
extern StandardOutput kout;
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)));