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 19 04:24:16 2014 +0000
Revision:
29:422616aa04bd
Parent:
19:3f82c1161fd2
Child:
31:c72e12cd5c67
Initial support for soft fonts compatible with mikroe font creator.

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 *
WiredHome 29:422616aa04bd 43 * @param x position in pixels
WiredHome 29:422616aa04bd 44 * @param y position in pixels
dreschpe 0:de9d1462a835 45 * @param c the character to be written to the TextDisplay
WiredHome 29:422616aa04bd 46 * @returns number of pixels to advance the cursor.
dreschpe 0:de9d1462a835 47 */
WiredHome 29:422616aa04bd 48 virtual int character(int x, int y, int c) = 0;
dreschpe 0:de9d1462a835 49
dreschpe 0:de9d1462a835 50 /** return number if rows on TextDisplay
dreschpe 0:de9d1462a835 51 * @result number of rows
dreschpe 0:de9d1462a835 52 */
dreschpe 0:de9d1462a835 53 virtual int rows() = 0;
dreschpe 0:de9d1462a835 54
dreschpe 0:de9d1462a835 55 /** return number if columns on TextDisplay
dreschpe 0:de9d1462a835 56 * @result number of rows
dreschpe 0:de9d1462a835 57 */
dreschpe 0:de9d1462a835 58 virtual int columns() = 0;
WiredHome 19:3f82c1161fd2 59
dreschpe 0:de9d1462a835 60 // functions that come for free, but can be overwritten
dreschpe 0:de9d1462a835 61
dreschpe 0:de9d1462a835 62 /** redirect output from a stream (stoud, sterr) to display
dreschpe 0:de9d1462a835 63 * @param stream stream that shall be redirected to the TextDisplay
dreschpe 0:de9d1462a835 64 */
dreschpe 0:de9d1462a835 65 virtual bool claim (FILE *stream);
dreschpe 0:de9d1462a835 66
dreschpe 0:de9d1462a835 67 /** clear screen
dreschpe 0:de9d1462a835 68 */
WiredHome 29:422616aa04bd 69 virtual RetCode_t cls() = 0;
WiredHome 19:3f82c1161fd2 70 virtual RetCode_t locate(unsigned int column, unsigned int row) = 0;
WiredHome 19:3f82c1161fd2 71 virtual RetCode_t foreground(uint16_t colour) = 0;
WiredHome 19:3f82c1161fd2 72 virtual RetCode_t background(uint16_t colour) = 0;
dreschpe 0:de9d1462a835 73 // putc (from Stream)
dreschpe 0:de9d1462a835 74 // printf (from Stream)
dreschpe 0:de9d1462a835 75
WiredHome 19:3f82c1161fd2 76 protected:
dreschpe 0:de9d1462a835 77 virtual int _putc(int value);
dreschpe 0:de9d1462a835 78 virtual int _getc();
dreschpe 0:de9d1462a835 79
dreschpe 0:de9d1462a835 80 // character location
dreschpe 0:de9d1462a835 81 uint16_t _column;
dreschpe 0:de9d1462a835 82 uint16_t _row;
dreschpe 0:de9d1462a835 83
dreschpe 0:de9d1462a835 84 // colours
dreschpe 0:de9d1462a835 85 uint16_t _foreground;
dreschpe 0:de9d1462a835 86 uint16_t _background;
dreschpe 0:de9d1462a835 87 char *_path;
dreschpe 0:de9d1462a835 88 };
dreschpe 0:de9d1462a835 89
dreschpe 0:de9d1462a835 90 #endif