A C12832 LCD with generic interface

Dependents:   mbed_blinky HTTPClient_HelloWorld websocketandnode xbeerx ... more

Fork of C12832 by Chris Styles

Committer:
chris
Date:
Sat Nov 09 01:02:48 2013 +0000
Revision:
12:4affce236743
Parent:
0:4bbc531be6e2
Child:
17:1c3011afe95d
Merged pin map changes;

Who changed what in which revision?

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