|
|
|
|
@ -5,17 +5,17 @@ SerialStream::SerialStream(ComPort port, BaudRate baud_rate, DataBits data_bits,
|
|
|
|
|
StopBits stop_bits, Parity parity)
|
|
|
|
|
:Serial(port, baud_rate, data_bits, stop_bits, parity) {}
|
|
|
|
|
|
|
|
|
|
SerialStream kout = SerialStream();
|
|
|
|
|
SerialStream sout = SerialStream();
|
|
|
|
|
|
|
|
|
|
void SerialStream::flush() {
|
|
|
|
|
print(kout.buffer, kout.pos);
|
|
|
|
|
kout.pos = 0;
|
|
|
|
|
print(sout.buffer, sout.pos);
|
|
|
|
|
sout.pos = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SerialStream::setForeground(Color c) {
|
|
|
|
|
write(0x1b);
|
|
|
|
|
write('[');
|
|
|
|
|
kout << 30+c;
|
|
|
|
|
sout << 30+c;
|
|
|
|
|
flush();
|
|
|
|
|
write('m');
|
|
|
|
|
}
|
|
|
|
|
@ -44,11 +44,11 @@ void SerialStream::setPos(int x, int y) {
|
|
|
|
|
//char out[] = {0x1b, '[', 0, 0, ';', 0, 0, 'H', 0};
|
|
|
|
|
//*this << 0x1b;
|
|
|
|
|
write(0x1b);
|
|
|
|
|
kout << '[';
|
|
|
|
|
kout << dec << x;
|
|
|
|
|
kout << ';';
|
|
|
|
|
kout << dec << y;
|
|
|
|
|
kout << 'H';
|
|
|
|
|
sout << '[';
|
|
|
|
|
sout << dec << x;
|
|
|
|
|
sout << ';';
|
|
|
|
|
sout << dec << y;
|
|
|
|
|
sout << 'H';
|
|
|
|
|
flush();
|
|
|
|
|
//itoa(x, &out[2], 10);
|
|
|
|
|
//itoa(y, &out[5], 10);
|
|
|
|
|
|