LED

Dependents:   LED_PWM_ansteuerung

Committer:
schoeni_91
Date:
Tue May 03 15:53:37 2016 +0000
Revision:
0:cbf905d4103b
f?r Rudi

Who changed what in which revision?

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