Committer:
martwerl
Date:
Thu Nov 15 17:25:27 2018 +0000
Revision:
0:54a8c9ae5155
AnalogInputPoti12_5a_Spannung_Strom

Who changed what in which revision?

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