Fork of Silabs MemoryLCD library

Dependents:   demoUI whrmDemoUI Host_Software_MAX32664GWEB_HR_EXTENDED Host_Software_MAX32664GWEC_SpO2_HR-_EXTE ... more

C++ library for Sharp Microelectronics 1.28 inch LCD TFT, LS013B7DH03, SPI bus. Forked from Silicon Labs MemoryLCD display driver.

Committer:
gmehmet
Date:
Wed Jan 02 13:20:35 2019 +0300
Revision:
12:ca0bcb4777e9
Parent:
11:0f8ae10b308d
adapt memorylcd code to use it with maxim boards

Who changed what in which revision?

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