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