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