Martin Werluschnig / Mbed 2 deprecated mbedAnalogIn

Dependencies:   mbed

Committer:
martwerl
Date:
Thu Nov 15 18:04:45 2018 +0000
Revision:
0:f0bb7332032f
mbedAnalogIn

Who changed what in which revision?

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