Displays a large title and some small text with a blue rectangle Constantly refreshes 3 variable values on the screen. NO TOUCH SUPPORT AS OF YET

Dependencies:   mbed

Committer:
EmbeddedSam
Date:
Sat Dec 05 23:41:01 2015 +0000
Revision:
0:38cf064697d7
First commit, working with displaying messages; no touch support as of yet

Who changed what in which revision?

UserRevisionLine numberNew contents of line
EmbeddedSam 0:38cf064697d7 1 /* mbed TextDisplay Library Base Class
EmbeddedSam 0:38cf064697d7 2 * Copyright (c) 2007-2009 sford
EmbeddedSam 0:38cf064697d7 3 * Released under the MIT License: http://mbed.org/license/mit
EmbeddedSam 0:38cf064697d7 4 *
EmbeddedSam 0:38cf064697d7 5 * A common base class for Text displays
EmbeddedSam 0:38cf064697d7 6 * To port a new display, derive from this class and implement
EmbeddedSam 0:38cf064697d7 7 * the constructor (setup the display), character (put a character
EmbeddedSam 0:38cf064697d7 8 * at a location), rows and columns (number of rows/cols) functions.
EmbeddedSam 0:38cf064697d7 9 * Everything else (locate, printf, putc, cls) will come for free
EmbeddedSam 0:38cf064697d7 10 *
EmbeddedSam 0:38cf064697d7 11 * The model is the display will wrap at the right and bottom, so you can
EmbeddedSam 0:38cf064697d7 12 * keep writing and will always get valid characters. The location is
EmbeddedSam 0:38cf064697d7 13 * maintained internally to the class to make this easy
EmbeddedSam 0:38cf064697d7 14 */
EmbeddedSam 0:38cf064697d7 15
EmbeddedSam 0:38cf064697d7 16 #ifndef MBED_TEXTDISPLAY_H
EmbeddedSam 0:38cf064697d7 17 #define MBED_TEXTDISPLAY_H
EmbeddedSam 0:38cf064697d7 18
EmbeddedSam 0:38cf064697d7 19 #include "mbed.h"
EmbeddedSam 0:38cf064697d7 20
EmbeddedSam 0:38cf064697d7 21 class TextDisplay : public Stream {
EmbeddedSam 0:38cf064697d7 22 public:
EmbeddedSam 0:38cf064697d7 23
EmbeddedSam 0:38cf064697d7 24 // functions needing implementation in derived implementation class
EmbeddedSam 0:38cf064697d7 25 /** Create a TextDisplay interface
EmbeddedSam 0:38cf064697d7 26 *
EmbeddedSam 0:38cf064697d7 27 * @param name The name used in the path to access the strean through the filesystem
EmbeddedSam 0:38cf064697d7 28 */
EmbeddedSam 0:38cf064697d7 29 TextDisplay(const char *name = NULL);
EmbeddedSam 0:38cf064697d7 30
EmbeddedSam 0:38cf064697d7 31 /** output a character at the given position
EmbeddedSam 0:38cf064697d7 32 *
EmbeddedSam 0:38cf064697d7 33 * @param column column where charater must be written
EmbeddedSam 0:38cf064697d7 34 * @param row where character must be written
EmbeddedSam 0:38cf064697d7 35 * @param c the character to be written to the TextDisplay
EmbeddedSam 0:38cf064697d7 36 */
EmbeddedSam 0:38cf064697d7 37 virtual void character(int column, int row, int c) = 0;
EmbeddedSam 0:38cf064697d7 38
EmbeddedSam 0:38cf064697d7 39 /** return number if rows on TextDisplay
EmbeddedSam 0:38cf064697d7 40 * @result number of rows
EmbeddedSam 0:38cf064697d7 41 */
EmbeddedSam 0:38cf064697d7 42 virtual int rows() = 0;
EmbeddedSam 0:38cf064697d7 43
EmbeddedSam 0:38cf064697d7 44 /** return number if columns on TextDisplay
EmbeddedSam 0:38cf064697d7 45 * @result number of rows
EmbeddedSam 0:38cf064697d7 46 */
EmbeddedSam 0:38cf064697d7 47 virtual int columns() = 0;
EmbeddedSam 0:38cf064697d7 48
EmbeddedSam 0:38cf064697d7 49 // functions that come for free, but can be overwritten
EmbeddedSam 0:38cf064697d7 50
EmbeddedSam 0:38cf064697d7 51 /** redirect output from a stream (stoud, sterr) to display
EmbeddedSam 0:38cf064697d7 52 * @param stream stream that shall be redirected to the TextDisplay
EmbeddedSam 0:38cf064697d7 53 */
EmbeddedSam 0:38cf064697d7 54 virtual bool claim (FILE *stream);
EmbeddedSam 0:38cf064697d7 55
EmbeddedSam 0:38cf064697d7 56 /** clear screen
EmbeddedSam 0:38cf064697d7 57 */
EmbeddedSam 0:38cf064697d7 58 virtual void cls();
EmbeddedSam 0:38cf064697d7 59 virtual void locate(int column, int row);
EmbeddedSam 0:38cf064697d7 60 virtual void foreground(uint16_t colour);
EmbeddedSam 0:38cf064697d7 61 virtual void background(uint16_t colour);
EmbeddedSam 0:38cf064697d7 62 // putc (from Stream)
EmbeddedSam 0:38cf064697d7 63 // printf (from Stream)
EmbeddedSam 0:38cf064697d7 64
EmbeddedSam 0:38cf064697d7 65 protected:
EmbeddedSam 0:38cf064697d7 66
EmbeddedSam 0:38cf064697d7 67 virtual int _putc(int value);
EmbeddedSam 0:38cf064697d7 68 virtual int _getc();
EmbeddedSam 0:38cf064697d7 69
EmbeddedSam 0:38cf064697d7 70 // character location
EmbeddedSam 0:38cf064697d7 71 uint16_t _column;
EmbeddedSam 0:38cf064697d7 72 uint16_t _row;
EmbeddedSam 0:38cf064697d7 73
EmbeddedSam 0:38cf064697d7 74 // colours
EmbeddedSam 0:38cf064697d7 75 uint16_t _foreground;
EmbeddedSam 0:38cf064697d7 76 uint16_t _background;
EmbeddedSam 0:38cf064697d7 77 char *_path;
EmbeddedSam 0:38cf064697d7 78 };
EmbeddedSam 0:38cf064697d7 79
EmbeddedSam 0:38cf064697d7 80 #endif