Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

See Components - RA8875 Based Display

Enhanced touch-screen support - where it previous supported both the Resistive Touch and Capacitive Touch based on the FT5206 Touch Controller, now it also has support for the GSL1680 Touch Controller.

Offline Help Manual (Windows chm)

/media/uploads/WiredHome/ra8875.zip.bin (download, rename to .zip and unzip)

Committer:
WiredHome
Date:
Sun Jan 12 17:40:32 2014 +0000
Revision:
19:3f82c1161fd2
Parent:
0:de9d1462a835
Child:
29:422616aa04bd
Initial commit - mostly working (not Triangles, Externals Fonts). Not ready for other users.

Who changed what in which revision?

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