|
|
|
|
@ -5,7 +5,9 @@ SerialStream::SerialStream(ComPort port, BaudRate baud_rate, DataBits data_bits,
|
|
|
|
|
StopBits stop_bits, Parity parity)
|
|
|
|
|
:Serial(port, baud_rate, data_bits, stop_bits, parity) {}
|
|
|
|
|
|
|
|
|
|
void SerialStream::flush() {}
|
|
|
|
|
void SerialStream::flush() {
|
|
|
|
|
print(buffer, strlen(buffer));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// https://stackoverflow.com/questions/3440726/what-is-the-proper-way-of-implementing-a-good-itoa-function
|
|
|
|
|
// Yet, another good itoa implementation
|
|
|
|
|
@ -76,10 +78,15 @@ void SerialStream::reset() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SerialStream::setPos(int x, int y) {
|
|
|
|
|
char out[] = {0x1b, '[', 0, 0, ';', 0, 0, 'H', 0};
|
|
|
|
|
itoa(x, &out[2], 10);
|
|
|
|
|
itoa(y, &out[5], 10);
|
|
|
|
|
print(out, strlen(out));
|
|
|
|
|
//char out[] = {0x1b, '[', 0, 0, ';', 0, 0, 'H', 0};
|
|
|
|
|
*this << 0x1b;
|
|
|
|
|
*this << '[';
|
|
|
|
|
*this << dec << x;
|
|
|
|
|
*this << ';' << y << 'H' << endl;
|
|
|
|
|
flush();
|
|
|
|
|
//itoa(x, &out[2], 10);
|
|
|
|
|
//itoa(y, &out[5], 10);
|
|
|
|
|
//print( out , strlen(out));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SerialStream::print(char* str, int length) {
|
|
|
|
|
|