mirror of
https://github.com/jscrane/r65emu.git
synced 2024-05-28 12:41:32 +00:00
change speed in serial filer
This commit is contained in:
parent
6a929aedbe
commit
1f64b85b17
|
@ -6,12 +6,22 @@
|
||||||
#include "serial_filer.h"
|
#include "serial_filer.h"
|
||||||
|
|
||||||
bool serial_filer::start(const char *) {
|
bool serial_filer::start(const char *) {
|
||||||
#if defined(TERM_SPEED)
|
|
||||||
Serial.begin(TERM_SPEED);
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
}
|
||||||
return false;
|
|
||||||
#endif
|
const unsigned speeds[] = {
|
||||||
|
115200, 57600, 19200, 9600, 4800, 2400
|
||||||
|
};
|
||||||
|
static unsigned currsp;
|
||||||
|
|
||||||
|
const char *serial_filer::advance() {
|
||||||
|
static char buf[16];
|
||||||
|
unsigned s = speeds[currsp];
|
||||||
|
Serial.begin(s);
|
||||||
|
currsp++;
|
||||||
|
if (currsp == sizeof(speeds)/sizeof(speeds[0]))
|
||||||
|
currsp = 0;
|
||||||
|
return itoa(s, buf, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void serial_filer::write(uint8_t b) {
|
void serial_filer::write(uint8_t b) {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#ifndef __SERIAL_FILER_H__
|
#ifndef __SERIAL_FILER_H__
|
||||||
#define __SERIAL_FILER_H__
|
#define __SERIAL_FILER_H__
|
||||||
|
|
||||||
|
// see https://playground.arduino.cc/Interfacing/LinuxTTY
|
||||||
|
// FIXME: do this in minicom config file
|
||||||
class serial_filer: public filer {
|
class serial_filer: public filer {
|
||||||
public:
|
public:
|
||||||
const char *advance() { return "serial"; }
|
const char *advance();
|
||||||
const char *rewind() { return advance(); }
|
const char *rewind() { return advance(); }
|
||||||
|
|
||||||
const char *checkpoint();
|
const char *checkpoint();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user