Simon Ford / Mbed 2 deprecated displays

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TextDisplay.h Source File

TextDisplay.h

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  * A common base class for Text displays
00006  * To port a new display, derive from this class and implement
00007  * the constructor (setup the display), character (put a character
00008  * at a location), rows and columns functions. Everything else
00009  * (locate, printf, putc, cls) will come for free
00010  */
00011 
00012 #ifndef MBED_TEXTDISPLAY_H
00013 #define MBED_TEXTDISPLAY_H
00014 
00015 #include "mbed.h"
00016 
00017 class TextDisplay : public Stream {
00018 public:
00019 
00020     // functions to implement in derived class
00021     TextDisplay();
00022     virtual void character(int column, int row, int c) = 0;
00023     virtual int rows() = 0;
00024     virtual int columns() = 0;
00025     
00026     virtual void cls();
00027     virtual void locate(int column, int row);
00028     virtual void foreground(int colour);
00029     virtual void background(int colour);
00030     // putc, printf also available from Stream
00031     
00032 protected:
00033 
00034     virtual int _putc(int value);
00035     virtual int _getc();
00036 
00037     // character location
00038     short _column;
00039     short _row;
00040 
00041     // colours
00042     int _foreground;
00043     int _background;
00044 };
00045 
00046 #endif