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
#define STANDARDOUTPUT_H
#include <avr/pgmspace.h>
#include "object/outputstream.h"
class StandardOutput : public OutputStream {
......@@ -12,6 +13,7 @@ class StandardOutput : public OutputStream {
void setup();
virtual void put(char c) override;
OutputStream & pprint(const char *text);
};
extern StandardOutput kout;
......
#include "driver/stdout.h"
#include <avr/io.h>
#include <avr/interrupt.h>
#ifndef BAUD
#define BAUD 9600UL
......@@ -24,6 +23,17 @@ void StandardOutput::setup()
//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)
{
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