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