This example uses the OLED display and the joystick on the Embedded Artists bseboard

Dependencies:   mbed

Committer:
chris
Date:
Tue Mar 02 07:23:59 2010 +0000
Revision:
0:6a7d6162034d

        

Who changed what in which revision?

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