![](/media/cache/profiles/c51ce410c124a10e0db5e4b97fc2af39.50x50_q85.jpg)
Library for the OLED display, as used on the mbed LPCXpresso Baseboard
Dependents: EAOLED_HelloWorld EA_BigBen NetClock_aitendoOLED_from_EA_and_nucho
Diff: TextDisplay.cpp
- Revision:
- 0:8fe8b0fe5134
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextDisplay.cpp Sun Jun 06 19:33:24 2010 +0000 @@ -0,0 +1,57 @@ +/* mbed TextDisplay Display Library Base Class + * Copyright (c) 2007-2009 sford + * Released under the MIT License: http://mbed.org/license/mit + */ + +#include "TextDisplay.h" + +TextDisplay::TextDisplay() { + _row = 0; + _column = 0; +} + +int TextDisplay::_putc(int value) { + if(value == '\n') { + _column = 0; + _row++; + if(_row >= rows()) { + _row = 0; + } + } else { + character(_column, _row, value); + _column++; + if(_column >= columns()) { + _column = 0; + _row++; + if(_row >= rows()) { + _row = 0; + } + } + } + return value; +} + +// crude cls implementation, should generally be overwritten in derived class +void TextDisplay::cls() { + locate(0, 0); + for(int i=0; i<columns()*rows(); i++) { + putc(' '); + } +} + +void TextDisplay::locate(int column, int row) { + _column = column; + _row = row; +} + +int TextDisplay::_getc() { + return -1; +} + +void TextDisplay::foreground(int colour) { + _foreground = colour; +} + +void TextDisplay::background(int colour) { + _background = colour; +}