Chinese module HY-1.8 SPI TFT lcd Display library.

Dependencies:   BurstSPI

Dependents:   KL25Z_DCF77_HY-1_8LCD

Fork of HY-1_8TFT_ST7735 by Paul Staron

Committer:
star297
Date:
Mon Mar 25 22:46:23 2013 +0000
Revision:
0:35a1964228b4
1st version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
star297 0:35a1964228b4 1 // ST7735 8 Bit SPI Library
star297 0:35a1964228b4 2
star297 0:35a1964228b4 3 #ifndef MBED_TEXTDISPLAY_H
star297 0:35a1964228b4 4 #define MBED_TEXTDISPLAY_H
star297 0:35a1964228b4 5
star297 0:35a1964228b4 6 #include "mbed.h"
star297 0:35a1964228b4 7
star297 0:35a1964228b4 8 class TextDisplay : public Stream {
star297 0:35a1964228b4 9 public:
star297 0:35a1964228b4 10
star297 0:35a1964228b4 11 // functions needing implementation in derived implementation class
star297 0:35a1964228b4 12 /** Create a TextDisplay interface
star297 0:35a1964228b4 13 *
star297 0:35a1964228b4 14 * @param name The name used in the path to access the strean through the filesystem
star297 0:35a1964228b4 15 */
star297 0:35a1964228b4 16 TextDisplay(const char *name = NULL);
star297 0:35a1964228b4 17
star297 0:35a1964228b4 18 /** output a character at the given position
star297 0:35a1964228b4 19 *
star297 0:35a1964228b4 20 * @param column column where charater must be written
star297 0:35a1964228b4 21 * @param row where character must be written
star297 0:35a1964228b4 22 * @param c the character to be written to the TextDisplay
star297 0:35a1964228b4 23 */
star297 0:35a1964228b4 24 virtual void character(int column, int row, int c) = 0;
star297 0:35a1964228b4 25
star297 0:35a1964228b4 26 /** return number if rows on TextDisplay
star297 0:35a1964228b4 27 * @result number of rows
star297 0:35a1964228b4 28 */
star297 0:35a1964228b4 29 virtual int rows() = 0;
star297 0:35a1964228b4 30
star297 0:35a1964228b4 31 /** return number if columns on TextDisplay
star297 0:35a1964228b4 32 * @result number of rows
star297 0:35a1964228b4 33 */
star297 0:35a1964228b4 34 virtual int columns() = 0;
star297 0:35a1964228b4 35
star297 0:35a1964228b4 36 // functions that come for free, but can be overwritten
star297 0:35a1964228b4 37
star297 0:35a1964228b4 38 /** redirect output from a stream (stoud, sterr) to display
star297 0:35a1964228b4 39 * @param stream stream that shall be redirected to the TextDisplay
star297 0:35a1964228b4 40 */
star297 0:35a1964228b4 41 virtual bool claim (FILE *stream);
star297 0:35a1964228b4 42
star297 0:35a1964228b4 43 /** clear screen
star297 0:35a1964228b4 44 */
star297 0:35a1964228b4 45 virtual void cls();
star297 0:35a1964228b4 46 virtual void locate(int column, int row);
star297 0:35a1964228b4 47 virtual void foreground(uint16_t colour);
star297 0:35a1964228b4 48 virtual void background(uint16_t colour);
star297 0:35a1964228b4 49 // putc (from Stream)
star297 0:35a1964228b4 50 // printf (from Stream)
star297 0:35a1964228b4 51
star297 0:35a1964228b4 52 protected:
star297 0:35a1964228b4 53
star297 0:35a1964228b4 54 virtual int _putc(int value);
star297 0:35a1964228b4 55 virtual int _getc();
star297 0:35a1964228b4 56
star297 0:35a1964228b4 57 // character location
star297 0:35a1964228b4 58 uint16_t _column;
star297 0:35a1964228b4 59 uint16_t _row;
star297 0:35a1964228b4 60
star297 0:35a1964228b4 61 // colours
star297 0:35a1964228b4 62 uint16_t _foreground;
star297 0:35a1964228b4 63 uint16_t _background;
star297 0:35a1964228b4 64 char *_path;
star297 0:35a1964228b4 65 };
star297 0:35a1964228b4 66
star297 0:35a1964228b4 67 #endif