To enable TextDisplays\' use as a lib I removed main.cpp

Dependents:   TextLCD_Serial

Committer:
giryan
Date:
Sun Sep 05 09:21:49 2010 +0000
Revision:
0:0e729fc7275a
Version of sford\s TextDisplays lib without main.cpp

Who changed what in which revision?

UserRevisionLine numberNew contents of line
giryan 0:0e729fc7275a 1 /* mbed TextDisplay Library Base Class
giryan 0:0e729fc7275a 2 * Copyright (c) 2007-2009 sford
giryan 0:0e729fc7275a 3 * Released under the MIT License: http://mbed.org/license/mit
giryan 0:0e729fc7275a 4 *
giryan 0:0e729fc7275a 5 * A common base class for Text displays
giryan 0:0e729fc7275a 6 * To port a new display, derive from this class and implement
giryan 0:0e729fc7275a 7 * the constructor (setup the display), character (put a character
giryan 0:0e729fc7275a 8 * at a location), rows and columns (number of rows/cols) functions.
giryan 0:0e729fc7275a 9 * Everything else (locate, printf, putc, cls) will come for free
giryan 0:0e729fc7275a 10 *
giryan 0:0e729fc7275a 11 * The model is the display will wrap at the right and bottom, so you can
giryan 0:0e729fc7275a 12 * keep writing and will always get valid characters. The location is
giryan 0:0e729fc7275a 13 * maintained internally to the class to make this easy
giryan 0:0e729fc7275a 14 */
giryan 0:0e729fc7275a 15
giryan 0:0e729fc7275a 16 #ifndef MBED_TEXTDISPLAY_H
giryan 0:0e729fc7275a 17 #define MBED_TEXTDISPLAY_H
giryan 0:0e729fc7275a 18
giryan 0:0e729fc7275a 19 #include "mbed.h"
giryan 0:0e729fc7275a 20
giryan 0:0e729fc7275a 21 class TextDisplay : public Stream {
giryan 0:0e729fc7275a 22 public:
giryan 0:0e729fc7275a 23
giryan 0:0e729fc7275a 24 // functions needing implementation in derived implementation class
giryan 0:0e729fc7275a 25 TextDisplay();
giryan 0:0e729fc7275a 26 virtual void character(int column, int row, int c) = 0;
giryan 0:0e729fc7275a 27 virtual int rows() = 0;
giryan 0:0e729fc7275a 28 virtual int columns() = 0;
giryan 0:0e729fc7275a 29
giryan 0:0e729fc7275a 30 // functions that come for free, but can be overwritten
giryan 0:0e729fc7275a 31 virtual void cls();
giryan 0:0e729fc7275a 32 virtual void locate(int column, int row);
giryan 0:0e729fc7275a 33 virtual void foreground(int colour);
giryan 0:0e729fc7275a 34 virtual void background(int colour);
giryan 0:0e729fc7275a 35 // putc (from Stream)
giryan 0:0e729fc7275a 36 // printf (from Stream)
giryan 0:0e729fc7275a 37
giryan 0:0e729fc7275a 38 protected:
giryan 0:0e729fc7275a 39
giryan 0:0e729fc7275a 40 virtual int _putc(int value);
giryan 0:0e729fc7275a 41 virtual int _getc();
giryan 0:0e729fc7275a 42
giryan 0:0e729fc7275a 43 // character location
giryan 0:0e729fc7275a 44 short _column;
giryan 0:0e729fc7275a 45 short _row;
giryan 0:0e729fc7275a 46
giryan 0:0e729fc7275a 47 // colours
giryan 0:0e729fc7275a 48 int _foreground;
giryan 0:0e729fc7275a 49 int _background;
giryan 0:0e729fc7275a 50 };
giryan 0:0e729fc7275a 51
giryan 0:0e729fc7275a 52 #endif