fixed library.

Dependents:   Sharp_Memory_LCD_Test hello_GT20L16J1Y_FONT_mlcd

Fork of sharp_mlcd by Masato YAMANISHI

Committer:
ban4jp
Date:
Sun Sep 21 08:05:33 2014 +0000
Revision:
3:d2aed1df064c
Parent:
0:c99dda90f834
Fix multi connection spi device issue.

Who changed what in which revision?

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