work on serialstream

main
Eggert Jung 6 months ago
parent 0cfcfe5fcb
commit 2fea91b6cf

@ -1,21 +1,33 @@
#include "serialstream.h" #include "serialstream.h"
SerialStream::SerialStream(ComPort port, BaudRate baud_rate, DataBits data_bits, SerialStream::SerialStream(ComPort port, BaudRate baud_rate, DataBits data_bits,
StopBits stop_bits, Parity parity) { StopBits stop_bits, Parity parity)
(void)port; :Serial(port, baud_rate, data_bits, stop_bits, parity) {}
(void)baud_rate;
(void)data_bits;
(void)stop_bits;
(void)parity;
}
void SerialStream::flush() {} void SerialStream::flush() {}
void SerialStream::setForeground(Color c) { (void)c; } void SerialStream::setForeground(Color c) {
write(0x1b);
write('[');
write('3');
write(c + 0x30);
write('m');
}
void SerialStream::setBackground(Color c) { (void)c; } void SerialStream::setBackground(Color c) {
write(0x1b);
write('[');
write('4');
write(c + 0x30);
write('m');
}
void SerialStream::setAttribute(Attrib a) { (void)a; } void SerialStream::setAttribute(Attrib a) {
write(0x1b);
write('[');
write(a + 0x30);
write('m');
}
void SerialStream::reset() {} void SerialStream::reset() {}
@ -25,6 +37,6 @@ void SerialStream::setPos(int x, int y) {
} }
void SerialStream::print(char* str, int length) { void SerialStream::print(char* str, int length) {
(void)str; for(int i=0; i < length; i++)
(void)length; write(str[i]);
} }

@ -5,6 +5,7 @@
#include "arch/cga.h" #include "arch/cga.h"
#include "arch/textwindow.h" #include "arch/textwindow.h"
#include "arch/serial.h" #include "arch/serial.h"
#include "device/serialstream.h"
// Main function // Main function
// (the bootstrap processor starts here)} // (the bootstrap processor starts here)}
@ -33,9 +34,20 @@ extern "C" int main() {
//tw.getPos(x,y); //tw.getPos(x,y);
//tw.setPos(x+1,y); //tw.setPos(x+1,y);
//test Serial ////test Serial
Serial s = Serial(); //Serial s = Serial();
s.write('a'); //s.write('a');
// test SerialStream
SerialStream ss = SerialStream();
ss.print("test", 4);
ss.setAttribute(SerialStream::UNDERSCORE);
ss.print("test", 4);
ss.setAttribute(SerialStream::RESET);
ss.setForeground(SerialStream::MAGENTA);
ss.print("test", 4);
ss.setBackground(SerialStream::CYAN);
ss.print("test", 4);
/* Start application processors /* Start application processors
* To avoid unexpected behaviour, make sure that interrupts are not * To avoid unexpected behaviour, make sure that interrupts are not

Loading…
Cancel
Save