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