1
0
mirror of https://github.com/jscrane/r65emu.git synced 2024-12-22 03:30:02 +00:00

serial filer

This commit is contained in:
Stephen Crane 2019-02-12 18:19:09 +00:00
parent 2bdf7a4fe3
commit 06f385b6cd
3 changed files with 50 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#include "keyboard.h" #include "keyboard.h"
#include "serialio.h" #include "serialio.h"
#include "filer.h" #include "filer.h"
#include "serial_filer.h"
#include "timed.h" #include "timed.h"
#include "hardware.h" #include "hardware.h"
#include "sound_dac.h" #include "sound_dac.h"

30
serial_filer.cpp Normal file
View File

@ -0,0 +1,30 @@
#include <Arduino.h>
#include <stdint.h>
#include "hardware.h"
#include "serialio.h"
#include "filer.h"
#include "serial_filer.h"
bool serial_filer::start(const char *) {
Serial.begin(TERM_SPEED);
return true;
}
void serial_filer::write(uint8_t b) {
Serial.write(b);
}
uint8_t serial_filer::read() {
return Serial.read();
}
bool serial_filer::more() {
return Serial.available() > 0;
}
const char *serial_filer::checkpoint() {
return 0;
}
void serial_filer::restore(const char *) {
}

19
serial_filer.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef __SERIAL_FILER_H__
#define __SERIAL_FILER_H__
class serial_filer: public filer {
public:
const char *advance() { return "serial"; }
const char *rewind() { return advance(); }
const char *checkpoint();
void restore(const char *);
bool start(const char *);
void stop() {}
uint8_t read();
bool more();
void write(uint8_t);
};
#endif