Fork of Silabs MemoryLCD library
Dependents: demoUI whrmDemoUI Host_Software_MAX32664GWEB_HR_EXTENDED Host_Software_MAX32664GWEC_SpO2_HR-_EXTE ... more
TextDisplay.h
00001 /* mbed TextDisplay Library Base Class 00002 * Copyright (c) 2007-2009 sford 00003 * Released under the MIT License: http://mbed.org/license/mit 00004 * 00005 * A common base class for Text displays 00006 * To port a new display, derive from this class and implement 00007 * the constructor (setup the display), character (put a character 00008 * at a location), rows and columns (number of rows/cols) functions. 00009 * Everything else (locate, printf, putc, cls) will come for free 00010 * 00011 * The model is the display will wrap at the right and bottom, so you can 00012 * keep writing and will always get valid characters. The location is 00013 * maintained internally to the class to make this easy 00014 */ 00015 00016 #ifndef MBED_TEXTDISPLAY_H 00017 #define MBED_TEXTDISPLAY_H 00018 00019 #include "../screen/LCDSettings.h" 00020 #include "mbed.h" 00021 00022 class TextDisplay { 00023 public: 00024 00025 // functions needing implementation in derived implementation class 00026 /** Create a TextDisplay interface 00027 * 00028 * @param name The name used in the path to access the strean through the filesystem 00029 */ 00030 TextDisplay(const char *name = NULL); 00031 00032 /** output a character at the given position 00033 * 00034 * @param column column where charater must be written 00035 * @param row where character must be written 00036 * @param c the character to be written to the TextDisplay 00037 */ 00038 virtual void character(int column, int row, int c) = 0; 00039 00040 /** return number if rows on TextDisplay 00041 * @result number of rows 00042 */ 00043 virtual int rows() = 0; 00044 00045 /** return number if columns on TextDisplay 00046 * @result number of rows 00047 */ 00048 virtual int columns() = 0; 00049 00050 // Sets external font usage, eg. dispaly.set_font(Arial12x12); 00051 // This uses pixel positioning. 00052 // display.set_font(NULL); returns to internal default font. 00053 void set_font(const unsigned char * f); 00054 00055 // set position of the next character or string print. 00056 // External font, set pixel x(column),y(row) position. 00057 // internal(default) font, set character column and row position 00058 virtual void locate(int column, int row); 00059 00060 // functions that come for free, but can be overwritten 00061 00062 /** clear screen 00063 */ 00064 virtual void cls(); 00065 virtual void foreground(uint16_t colour); 00066 virtual void background(uint16_t colour); 00067 // putc (from Stream) 00068 // printf (from Stream) 00069 virtual void printf(const char* format, ...); 00070 00071 protected: 00072 00073 virtual int _putc(int value); 00074 virtual int _getc(); 00075 00076 // external font functions 00077 const unsigned char* font; 00078 int externalfont; 00079 00080 // character location 00081 uint16_t _column; 00082 uint16_t _row; 00083 unsigned int char_x; 00084 unsigned int char_y; 00085 00086 // colours 00087 uint16_t _foreground; 00088 uint16_t _background; 00089 char *_path; 00090 }; 00091 00092 #endif
Generated on Thu Jul 14 2022 00:59:54 by 1.7.2