Linux: Serial minor update (#1053)

- The symlink name for the PTY device is set using --my-serial-port
  making --my-serial-pty deprecated
- Replace MY_LINUX_IS_SERIAL_PTY with MY_LINUX_SERIAL_IS_PTY
- MY_DEBUGDEVICE can be used to print debug messages from MySensors
  (as it is currently in the other architectures)
- Rename SerialSimulator class to StdInOutStream
- Remove old deprecated option --my-radio
This commit is contained in:
Marcelo Aquino
2018-02-13 13:22:27 +01:00
committed by tekka
parent 6794c72ecd
commit 54fb250ab2
7 changed files with 80 additions and 41 deletions
@@ -18,39 +18,39 @@
*/
#include <stdio.h>
#include "SerialSimulator.h"
#include "StdInOutStream.h"
void SerialSimulator::begin(int baud)
void StdInOutStream::begin(int baud)
{
(void)baud;
}
int SerialSimulator::available()
int StdInOutStream::available()
{
return 1;
}
int SerialSimulator::read()
int StdInOutStream::read()
{
return getchar();
}
size_t SerialSimulator::write(uint8_t b)
size_t StdInOutStream::write(uint8_t b)
{
return (size_t)::printf("%c", b);
}
int SerialSimulator::peek()
int StdInOutStream::peek()
{
return -1;
}
void SerialSimulator::flush()
void StdInOutStream::flush()
{
fflush(stdout);
}
void SerialSimulator::end()
void StdInOutStream::end()
{
flush();
}
@@ -17,8 +17,8 @@
* version 2 as published by the Free Software Foundation.
*/
#ifndef SerialSimulator_h
#define SerialSimulator_h
#ifndef StdInOutStream_h
#define StdInOutStream_h
#include <stdlib.h>
#include <stdio.h>
@@ -26,9 +26,9 @@
#include "Stream.h"
/**
* @brief A class equivalent to Serial in Arduino but outputs to stdout
* @brief A class that prints to stdout and reads from stdin
*/
class SerialSimulator : public Stream
class StdInOutStream : public Stream
{
public: