A TextDisplay driver that supports graphical displays using on of the SED133x conrtrolers. Allows stdout and stderr output to be redirected to the display.
Diff: TextDisplay.cpp
- Revision:
- 1:18c56f038905
- Parent:
- 0:9e72c57b16fd
- Child:
- 2:8596e06f241f
--- a/TextDisplay.cpp Sat Jan 08 22:24:00 2011 +0000 +++ b/TextDisplay.cpp Sat Jan 15 16:02:56 2011 +0000 @@ -2,28 +2,28 @@ * Copyright (c) 2007-2009 sford * Released under the MIT License: http://mbed.org/license/mit */ - + #include "TextDisplay.h" -TextDisplay::TextDisplay() { +TextDisplay::TextDisplay(const char *name) : Stream(name) { _row = 0; _column = 0; } - + int TextDisplay::_putc(int value) { - if(value == '\n') { + if (value == '\n') { _column = 0; _row++; - if(_row >= rows()) { + if (_row >= rows()) { _row = 0; } } else { character(_column, _row, value); _column++; - if(_column >= columns()) { + if (_column >= columns()) { _column = 0; _row++; - if(_row >= rows()) { + if (_row >= rows()) { _row = 0; } } @@ -34,7 +34,7 @@ // crude cls implementation, should generally be overwritten in derived class void TextDisplay::cls() { locate(0, 0); - for(int i=0; i<columns()*rows(); i++) { + for (int i=0; i<columns()*rows(); i++) { putc(' '); } } @@ -47,7 +47,7 @@ int TextDisplay::_getc() { return -1; } - + void TextDisplay::foreground(uint32_t colour) { _foreground = colour; }