Maxim nexpaq / nexpaq_dev
Committer:
nexpaq
Date:
Fri Nov 04 20:27:58 2016 +0000
Revision:
0:6c56fb4bc5f0
Moving to library for sharing updates

Who changed what in which revision?

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