r65emu/serial_filer.h

30 lines
584 B
C
Raw Normal View History

2019-02-12 18:19:09 +00:00
#ifndef __SERIAL_FILER_H__
#define __SERIAL_FILER_H__
2019-03-26 19:27:25 +00:00
class HardwareSerial;
2019-02-14 07:58:51 +00:00
// see https://playground.arduino.cc/Interfacing/LinuxTTY
// FIXME: do this in minicom config file
2019-02-12 18:19:09 +00:00
class serial_filer: public filer {
public:
2019-03-26 19:27:25 +00:00
serial_filer(HardwareSerial &serial): _serial(serial) {}
2019-02-14 07:58:51 +00:00
const char *advance();
2019-02-14 18:02:26 +00:00
const char *rewind() { _currsp = 0; return advance(); }
2019-02-12 18:19:09 +00:00
const char *checkpoint();
void restore(const char *);
2019-03-26 19:27:25 +00:00
bool start() { return true; }
2019-02-12 18:19:09 +00:00
void stop() {}
uint8_t read();
bool more();
void write(uint8_t);
2019-02-14 18:02:26 +00:00
private:
2019-03-26 19:27:25 +00:00
HardwareSerial &_serial;
2019-02-14 18:02:26 +00:00
unsigned _currsp;
2019-02-12 18:19:09 +00:00
};
#endif