Simon Ford / Mbed 2 deprecated displays

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TextDisplay.cpp Source File

TextDisplay.cpp

00001 /* mbed TextDisplay Display Library Base Class
00002  * Copyright (c) 2007-2009 sford
00003  * Released under the MIT License: http://mbed.org/license/mit
00004  */
00005  
00006 #include "TextDisplay.h"
00007 
00008 TextDisplay::TextDisplay() {
00009     _row = 0;
00010     _column = 0;
00011 }
00012     
00013 int TextDisplay::_putc(int value) {
00014     if(value == '\n') {
00015         _column = 0;
00016         _row++;
00017         if(_row >= rows()) {
00018             _row = 0;
00019         }
00020     } else {
00021         character(_column, _row, value);
00022         _column++;
00023         if(_column >= columns()) {
00024             _column = 0;
00025             _row++;
00026             if(_row >= rows()) {
00027                 _row = 0;
00028             }
00029         }
00030     }
00031     return value;
00032 }
00033 
00034 void TextDisplay::cls() {
00035     locate(0, 0);
00036     for(int i=0; i<columns()*rows(); i++) {
00037         putc(' ');
00038     }
00039 }
00040 
00041 void TextDisplay::locate(int column, int row) {
00042     _column = column;
00043     _row = row;
00044 }
00045 
00046 int TextDisplay::_getc() {
00047     return -1;
00048 }
00049         
00050 void TextDisplay::foreground(int colour) {
00051     _foreground = colour;
00052 }
00053 
00054 void TextDisplay::background(int colour) {
00055     _background = colour;
00056 }