add missing files

This commit is contained in:
steve 2024-10-12 14:40:55 +01:00
parent de511a2346
commit 869ce26a7a
2 changed files with 48 additions and 0 deletions

31
terminal_disp.cpp Normal file
View File

@ -0,0 +1,31 @@
#include <Arduino.h>
#include <serial_dsp.h>
#include "disp.h"
#include "terminal_disp.h"
void terminal_disp::status(const char *s) {
_p.println(s);
}
void terminal_disp::write(uint8_t b) {
char c = (char)b;
switch(c) {
case '_':
_p.write(' ');
_p.write('\b');
_p.write('\b');
_p.write('_');
_p.write('\b');
break;
case '\r':
_p.write(' ');
_p.write('\r');
_p.write('\n');
break;
default:
_p.write(b);
break;
}
_p.write('_');
_p.write('\b');
}

17
terminal_disp.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef __TERMINAL_DISP_H__
#define __TERMINAL_DISP_H__
class terminal_disp: public disp {
public:
terminal_disp(Print &p): _p(p) {}
void checkpoint(Stream &) {}
void restore(Stream &) {}
void status(const char *);
void write(uint8_t);
private:
Print &_p;
};
#endif