mirror of
https://github.com/jscrane/r65emu.git
synced 2024-12-22 03:30:02 +00:00
serial filer
This commit is contained in:
parent
2bdf7a4fe3
commit
06f385b6cd
1
r65emu.h
1
r65emu.h
@ -11,6 +11,7 @@
|
||||
#include "keyboard.h"
|
||||
#include "serialio.h"
|
||||
#include "filer.h"
|
||||
#include "serial_filer.h"
|
||||
#include "timed.h"
|
||||
#include "hardware.h"
|
||||
#include "sound_dac.h"
|
||||
|
30
serial_filer.cpp
Normal file
30
serial_filer.cpp
Normal 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
19
serial_filer.h
Normal 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
|
Loading…
Reference in New Issue
Block a user