Martin Werluschnig / Mbed 2 deprecated TINF_GrenzwertUeberwachnug

Dependencies:   mbed

Committer:
martwerl
Date:
Thu Nov 15 18:16:10 2018 +0000
Revision:
0:2f77ffaa208d
TINF_GrenzwertUeberwachnug

Who changed what in which revision?

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