![]() |
Max OS 0.3
|
A driver for the serial output. More...
#include <serial.h>
Public Member Functions | |
| SerialConsole (Logger *logger) | |
| Constructs a new Serial Console object and initialises the serial port. | |
| void | put_character (char c) |
| Waits for the serial port to be ready, then writes a character to it. | |
| void | write_char (char c) final |
| Writes a character to the output stream. | |
Public Member Functions inherited from MaxOS::drivers::Driver | |
| virtual void | activate () |
| Activate the driver. | |
| virtual void | deactivate () |
| Deactivate the driver. | |
| virtual void | initialise () |
| Initialise the driver. | |
| virtual uint32_t | reset () |
| Reset the driver. | |
| virtual string | vendor_name () |
| Get who created the device. | |
| virtual string | device_name () |
| Get the device name of the driver. | |
Public Member Functions inherited from MaxOS::common::OutputStream | |
| OutputStream () | |
| Constructs an OutputStream object that uses strings as the underlying data type. | |
| virtual void | line_feed () |
| Writes a newline to the output stream. | |
| virtual void | carriage_return () |
| Writes a carriage return to the output stream. | |
| virtual void | clear () |
| Clears the output stream. | |
| void | write (string string_to_write) override |
| Writes a string to the output stream. | |
| void | write (const char *string_to_write) |
| Writes a string to the output stream. | |
| virtual void | write_int (int int_to_write) |
| Writes an integer to the output stream. | |
| virtual void | write_hex (uint64_t hex_to_write) |
| Writes a hex to the output stream. | |
| OutputStream & | operator<< (string string_to_write) override |
| Writes a string to the output stream. | |
| OutputStream & | operator<< (const char *string_to_write) |
| Writes a string to the output stream. | |
| OutputStream & | operator<< (int int_to_write) |
| Writes a integer to the output stream. | |
| OutputStream & | operator<< (uint64_t hex_to_write) |
| Writes a hexadecimal to the output stream. | |
| OutputStream & | operator<< (char char_to_write) |
| Writes a character to the output stream. | |
Public Member Functions inherited from MaxOS::common::GenericOutputStream< string > | |
| GenericOutputStream () | |
| __________________________________________Templates__________________________________________________/// | |
| ~GenericOutputStream () | |
| Destructor of the GenericOutputStream class. | |
| void | on_stream_read (string) override |
| Writes the date that was read from the input stream to the output stream. | |
| void | on_end_of_stream (GenericInputStream< string > *) override |
| Close the stream and remove it from the list of streams when the end of the stream is reached. | |
| virtual void | write (string) |
| write an element to the stream. | |
| virtual void | close () |
| Close the stream. | |
| virtual GenericOutputStream< string > & | operator<< (string) |
| Overload the << operator to write an element to the stream. | |
Public Member Functions inherited from MaxOS::common::InputStreamProcessor< Type, ProcessorType > | |
| InputStreamProcessor () | |
| Creates a new InputStreamProcessor. | |
| InputStreamProcessor (InputStreamEventHandler< ProcessorType > *generic_stream_event_handler) | |
| Creates a new InputStreamProcessor. | |
| ~InputStreamProcessor () | |
| Destroys the InputStreamProcessor. | |
| void | on_end_of_stream (GenericInputStream< Type > *stream) override |
| Called when a stream has finished. Passes the event on to the handlers and then removes the stream from the array of streams. | |
Public Member Functions inherited from MaxOS::common::InputStreamEventHandler< Type > | |
| InputStreamEventHandler () | |
| _______________________________________________TEMPLATES_________________________________________________________________/// | |
| ~InputStreamEventHandler () | |
| Destroys the InputStreamProcessor and disconnects it from all streams. | |
Public Member Functions inherited from MaxOS::common::GenericInputStream< ProcessorType > | |
| GenericInputStream () | |
| Creates a new GenericInputStream. | |
| GenericInputStream (InputStreamEventHandler< ProcessorType > *) | |
| Creates a new GenericInputStream and connects it to the handler. | |
| ~GenericInputStream () | |
| Destroys the GenericInputStream and disconnects all handlers. | |
| void | connect_input_stream_event_handler (InputStreamEventHandler< ProcessorType > *) |
| Adds a inputStreamEventHandler to the list of internetProtocolHandlers. | |
| void | disconnect_input_stream_event_handler (InputStreamEventHandler< ProcessorType > *) |
| Removes a handler from the list of handlers. | |
Additional Inherited Members | |
Protected Attributes inherited from MaxOS::common::InputStreamEventHandler< Type > | |
| common::Vector< GenericInputStream< Type > * > | m_generic_input_streams |
| List of streams being observed by this handler. | |
Protected Attributes inherited from MaxOS::common::GenericInputStream< ProcessorType > | |
| common::Vector< InputStreamEventHandler< ProcessorType > * > | m_input_stream_event_handlers |
| List of streams being observed by this handler. | |
|
explicit |
Constructs a new Serial Console object and initialises the serial port.
| logger | The logger which will use this serial console as a log writer |
Definition at line 18 of file serial.cpp.
References MaxOS::Logger::add_log_writer(), MaxOS::hardwarecommunication::Port8Bit::read(), and MaxOS::hardwarecommunication::Port8Bit::write().
| void SerialConsole::put_character | ( | char | c | ) |
Waits for the serial port to be ready, then writes a character to it.
| c | The character to write |
Definition at line 66 of file serial.cpp.
References MaxOS::hardwarecommunication::Port8Bit::read(), and MaxOS::hardwarecommunication::Port8Bit::write().
Referenced by write_char().
|
finalvirtual |
Writes a character to the output stream.
| char_to_write | The character to write to the output stream. |
Reimplemented from MaxOS::common::OutputStream.
Definition at line 76 of file serial.cpp.
References put_character().