Skip to content
Snippets Groups Projects
Unverified Commit 102e6f03 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

lora32u4ii: stdout: Add pprint for PSTR (pgmspace strings)

parent d79ef3a1
No related branches found
No related tags found
No related merge requests found
#ifndef STANDARDOUTPUT_H #ifndef STANDARDOUTPUT_H
#define STANDARDOUTPUT_H #define STANDARDOUTPUT_H
#include <avr/pgmspace.h>
#include "object/outputstream.h" #include "object/outputstream.h"
class StandardOutput : public OutputStream { class StandardOutput : public OutputStream {
...@@ -12,6 +13,7 @@ class StandardOutput : public OutputStream { ...@@ -12,6 +13,7 @@ class StandardOutput : public OutputStream {
void setup(); void setup();
virtual void put(char c) override; virtual void put(char c) override;
OutputStream & pprint(const char *text);
}; };
extern StandardOutput kout; extern StandardOutput kout;
......
#include "driver/stdout.h" #include "driver/stdout.h"
#include <avr/io.h> #include <avr/io.h>
#include <avr/interrupt.h>
#ifndef BAUD #ifndef BAUD
#define BAUD 9600UL #define BAUD 9600UL
...@@ -24,6 +23,17 @@ void StandardOutput::setup() ...@@ -24,6 +23,17 @@ void StandardOutput::setup()
//UCSR1D = 0; //UCSR1D = 0;
} }
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) void StandardOutput::put(char c)
{ {
while (!(UCSR1A & _BV(UDRE1))); while (!(UCSR1A & _BV(UDRE1)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment