Library for the OLED display, as used on the mbed LPCXpresso Baseboard

Dependencies:   mbed

Dependents:   EAOLED_HelloWorld EA_BigBen NetClock_aitendoOLED_from_EA_and_nucho

Committer:
simon
Date:
Sun Jun 06 19:33:24 2010 +0000
Revision:
0:8fe8b0fe5134

        

Who changed what in which revision?

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