Driver to control the EM027BS013 board from Embedded Artists

Dependencies:   EM027BS013

EM027BS013 Simple Driver

This library provides an easy way to write data to the EM027BS013 display, by providing interfaces to common C functions and methods. The library was originally written by Peter Drescher, who created the "EaEpaper" library for the EM027AS012 display (available here, but adapted to use the newer display type and driver (available here), as the existing display is now discontinued.

Big thanks go to the team from Pervasive Displays and Electronic Artists for producing such a nice display, and to Peter for providing the initial interface used in this driver.

Committer:
Leigh_LbR
Date:
Thu May 19 14:08:34 2016 +0000
Revision:
1:46dfef41919b
Parent:
0:e36f1973a674
Added API documentation;

Who changed what in which revision?

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