00001 /* mbed TextDisplay Library Base Class00002 * Copyright (c) 2007-2009 sford00003 * Released under the MIT License: http://mbed.org/license/mit00004 *00005 * A common base class for Text displays00006 * To port a new display, derive from this class and implement00007 * the constructor (setup the display), character (put a character00008 * at a location), rows and columns (number of rows/cols) functions.00009 * Everything else (locate, printf, putc, cls) will come for free00010 *00011 * The model is the display will wrap at the right and bottom, so you can00012 * keep writing and will always get valid characters. The location is 00013 * maintained internally to the class to make this easy00014 */00015
00016 #ifndef MBED_TEXTDISPLAY_H00017 #define MBED_TEXTDISPLAY_H00018
00019 #include "mbed.h"00020
00021 class TextDisplay : public Stream {
00022 public:
00023
00024 // functions needing implementation in derived implementation class00025 TextDisplay();
00026 virtualvoid character(int column, int row, int c) = 0;
00027 virtualint rows() = 0;
00028 virtualint columns() = 0;
00029
00030 // functions that come for free, but can be overwritten00031 virtualvoid cls();
00032 virtualvoid locate(int column, int row);
00033 virtualvoid foreground(int colour);
00034 virtualvoid background(int colour);
00035 // putc (from Stream)00036 // printf (from Stream)00037
00038 protected:
00039
00040 virtualint _putc(int value);
00041 virtualint _getc();
00042
00043 // character location00044 short _column;
00045 short _row;
00046
00047 // colours00048 int _foreground;
00049 int _background;
00050 };
00051
00052 #endif