mirror of
https://github.com/jscrane/r65emu.git
synced 2025-03-12 03:34:22 +00:00
implement rewind properly
This commit is contained in:
parent
1f64b85b17
commit
ab85adce3d
@ -12,15 +12,14 @@ bool serial_filer::start(const char *) {
|
|||||||
const unsigned speeds[] = {
|
const unsigned speeds[] = {
|
||||||
115200, 57600, 19200, 9600, 4800, 2400
|
115200, 57600, 19200, 9600, 4800, 2400
|
||||||
};
|
};
|
||||||
static unsigned currsp;
|
|
||||||
|
|
||||||
const char *serial_filer::advance() {
|
const char *serial_filer::advance() {
|
||||||
static char buf[16];
|
static char buf[16];
|
||||||
unsigned s = speeds[currsp];
|
unsigned s = speeds[_currsp];
|
||||||
Serial.begin(s);
|
Serial.begin(s);
|
||||||
currsp++;
|
_currsp++;
|
||||||
if (currsp == sizeof(speeds)/sizeof(speeds[0]))
|
if (_currsp == sizeof(speeds)/sizeof(speeds[0]))
|
||||||
currsp = 0;
|
_currsp = 0;
|
||||||
return itoa(s, buf, 10);
|
return itoa(s, buf, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
class serial_filer: public filer {
|
class serial_filer: public filer {
|
||||||
public:
|
public:
|
||||||
const char *advance();
|
const char *advance();
|
||||||
const char *rewind() { return advance(); }
|
const char *rewind() { _currsp = 0; return advance(); }
|
||||||
|
|
||||||
const char *checkpoint();
|
const char *checkpoint();
|
||||||
void restore(const char *);
|
void restore(const char *);
|
||||||
@ -17,5 +17,8 @@ public:
|
|||||||
uint8_t read();
|
uint8_t read();
|
||||||
bool more();
|
bool more();
|
||||||
void write(uint8_t);
|
void write(uint8_t);
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned _currsp;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user