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