Max OS 0.3
Loading...
Searching...
No Matches
serial.h
Go to the documentation of this file.
1
9#ifndef MAXOS_SERIAL_H
10#define MAXOS_SERIAL_H
11
12#include <libcommon/port.h>
13
14#include <common/logger.h>
15
16namespace MaxOS::console {
17
18
19
20
25 class SerialConsole : public common::OutputStream {
26
27 private:
28 common::Port8Bit m_data_port;
29 common::Port8Bit m_interrupt_enable_port;
30 common::Port8Bit m_fifo_control_port;
31 common::Port8Bit m_line_control_port;
32 common::Port8Bit m_modem_control_port;
33 common::Port8Bit m_line_status_port;
34
35 public:
36 explicit SerialConsole();
37 explicit SerialConsole(Logger* logger);
39
40 void put_character(char c);
41 void write_char(char c) final;
42
43 bool can_read();
44 char read_char();
45
46 };
47
48}
49
50
51#endif // MAXOS_SERIAL_H
A class that handles logging messages to the console and files.
Definition logger.h:51
A driver for the serial output.
Definition serial.h:25
char read_char()
Read data from the serial port.
Definition serial.cpp:117
void write_char(char c) final
Waits for the serial port to be ready, then writes a character to it.
Definition serial.cpp:99
void put_character(char c)
Waits for the serial port to be ready, then writes a character to it.
Definition serial.cpp:84
bool can_read()
Checks if data can be read from the serial port.
Definition serial.cpp:108
SerialConsole()
Constructs a new Serial Console object and initialises the serial port.
Definition serial.cpp:19
Defines a Logger class for logging messages with different severity levels to multiple output streams...