modm API documentation
modm::CharacterDisplay Class Referenceabstract

#include <modm/ui/display/character_display.hpp>

Inheritance diagram for modm::CharacterDisplay:
modm::IOStream modm::Hd44780< DATA, RW, RS, E > modm::Hd44780Dual< DATA, RW, RS, E1, E2 > modm::St7036< SPI, CS, RS, Width, Heigth > modm::St7036< SPI, CS, RS, 16, 2 > modm::St7036< SPI, CS, RS, 16, 3 > modm::St7036< SPI, CS, RS, 8, 1 > modm::DogM162< SPI, CS, RS > modm::DogM163< SPI, CS, RS > modm::DogM081< SPI, CS, RS >


class  Writer

Public Types

enum  Command {
  ClearDisplay = 0b00000001, ResetCursor = 0b00000010, IncrementCursor = 0b00000110, DecrementCursor = 0b00000100,
  DisableDisplay = 0b00001000, EnableDisplay = 0b00001100, DisableCursor = 0b00001000, EnableCursor = 0b00001010,
  DisableCursorBlink = 0b00001000, EnableCursorBlink = 0b00001001, ShiftCursorLeft = 0b00010000, ShiftCursorRight = 0b00010100

Public Member Functions

 CharacterDisplay (uint8_t width, uint8_t height)
void initialize ()
 Initialize the display.
void write (char c)
virtual void writeRaw (char c) = 0
void execute (Command command)
virtual void setCursor (uint8_t column, uint8_t line) = 0
void clear ()
 clear the entire display and reset the cursor
- Public Member Functions inherited from modm::IOStream
 IOStream (IODevice &odevice)
IOStream & write (char c)
IOStream & get (char &c)
 Reads one character and returns it if available. Otherwise, returns IOStream::eof.
IOStream & get (char *s, size_t n)
template<size_t N>
IOStream & get (char (&s)[N])
IOStream & flush ()
IOStream & endl ()
IOStream & bin ()
 set the output mode to binary style for integer types
IOStream & hex ()
 set the output mode to hexadecimal style for integer types
IOStream & ascii ()
 set the output mode to ASCII style for integer types
IOStream & operator<< (const bool &v)
IOStream & operator<< (const char &v)
IOStream & operator<< (const uint8_t &v)
IOStream & operator<< (const int16_t &v)
IOStream & operator<< (const uint16_t &v)
IOStream & operator<< (const int32_t &v)
IOStream & operator<< (const uint32_t &v)
IOStream & operator<< (const int64_t &v)
IOStream & operator<< (const uint64_t &v)
IOStream & operator<< (const int &v)
IOStream & operator<< (const unsigned int &v)
IOStream & operator<< (const float &v)
IOStream & operator<< (const double &v)
IOStream & operator<< (const char *s)
IOStream & operator<< (const void *p)
 write the hex value of a pointer
template<class Ret , class... Args>
IOStream & operator<< (Ret (*pointer)(Args...))
 Write the hex value of any function pointer.
IOStream & operator<< (IOStream &(*format)(IOStream &))
IOStream & printf (const char *fmt,...)))
IOStream & vprintf (const char *fmt, va_list vlist)))

Protected Attributes

Writer writer
uint8_t lineWidth
uint8_t lineCount
uint8_t column
uint8_t line

Additional Inherited Members

- Static Public Attributes inherited from modm::IOStream
static constexpr char eof = -1
- Protected Member Functions inherited from modm::IOStream
template<typename T >
void writeIntegerMode (const T v)
void writeInteger (int16_t value)
void writeInteger (uint16_t value)
void writeInteger (int32_t value)
void writeInteger (uint32_t value)
void writeInteger (int64_t value)
void writeInteger (uint64_t value)
void writeFloat (float value)
void writeDouble (const double &value)
void writePointer (const void *value)
void writeHex (uint8_t value)
void writeBin (uint8_t value)

Detailed Description

Base class for alpha-numeric LCDs (liquid crystal display)

About this implementation:

In contrast to other drivers which use static methods, this class is directly derived from modm::IODevice with all the virtual methods because it will be most likely used to create a IOStream which then handles the output to the display.

Therefore creating this class with static methods and using a wrapper class to create a modm::IODevice seems unnecessary complicated.

Fabian Greif

Member Enumeration Documentation

Enum ValuesDocumentation

Clear the display content.


Set cursor to position (0,0)


Increments address upon write.


Decrements address upon write.


Disable display.


Enable display.


Disable cursor.


Enable cursor.


Disable blinking cursor.


Enable blinking cursor.


Shift cursor left.


Shift cursor right.

Member Function Documentation

void modm::CharacterDisplay::execute ( Command  command)

Excute a command.

See also
commandCommand to execute
virtual void modm::CharacterDisplay::setCursor ( uint8_t  column,
uint8_t  line 
pure virtual
void modm::CharacterDisplay::write ( char  c)

Write a character

This method provides an automatic wrap-round if the output reaches the end of the current line or a newline character is detected.

Use writeRaw() if this behavior is not wanted.

virtual void modm::CharacterDisplay::writeRaw ( char  c)
pure virtual

The documentation for this class was generated from the following files: