TINF_MittelwerteUeberwachung

Dependencies:   mbed

Committer:
martwerl
Date:
Thu Nov 15 18:24:11 2018 +0000
Revision:
0:fb8791842ef8
TINF_MittelwerteUeberwachung

Who changed what in which revision?

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