Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
MobileLCD.h
00001 00002 #ifndef MBED_MOBILELCD_H 00003 #define MBED_MOBILELCD_H 00004 00005 #include "mbed.h" 00006 00007 class MobileLCD { 00008 00009 public: 00010 00011 MobileLCD(PinName mosi, PinName miso, PinName clk, PinName cs, PinName rst); 00012 00013 void cls(); 00014 int width(); 00015 int height(); 00016 void foreground(int v); 00017 void background(int v); 00018 void fill(int x, int y, int width, int height, int colour); 00019 void reset(); 00020 void pixel(int x, int y, int colour); 00021 void setpixel(int x, int y, int colour); 00022 void setline(int x0, int y0, int x1, int y1, int color); 00023 void setrect(int x0, int y0, int x1, int y1, unsigned char fill, int color); 00024 void setcircle(int x0, int y0, int radius, int color); 00025 void putchar(int x, int y, int size, int value, int fColor, int bColor); 00026 void bitblit(int x, int y, int width, int height, const char* bitstream, int fColor, int bColor); 00027 00028 protected: 00029 00030 SPI _spi; 00031 DigitalOut _rst; 00032 DigitalOut _cs; 00033 00034 void _select(); 00035 void _deselect(); 00036 void _window(int x, int y, int width, int height); 00037 void command(int value); 00038 void data(int value); 00039 00040 int _foreground, _background, _width, _height; 00041 }; 00042 00043 #define DISON 0xAF // Display on 00044 #define DISOFF 0xAE // Display off 00045 #define DISNOR 0xA6 // Normal display 00046 #define DISINV 0xA7 // Inverse display 00047 #define COMSCN 0xBB // Common scan direction 00048 #define DISCTL 0xCA // Display control 00049 #define SLPIN 0x95 // Sleep in 00050 #define SLPOUT 0x94 // Sleep out 00051 #define PASET 0x75 // Page address set 00052 #define CASET 0x15 // Column address set 00053 #define DATCTL 0xBC // Data scan direction, etc. 00054 #define RGBSET8 0xCE // 256-color position set 00055 #define RAMWR 0x5C // Writing to memory 00056 #define RAMRD 0x5D // Reading from memory 00057 #define PTLIN 0xA8 // Partial display in 00058 #define PTLOUT 0xA9 // Partial display out 00059 #define RMWIN 0xE0 // Read and modify write 00060 #define RMWOUT 0xEE // End 00061 #define ASCSET 0xAA // Area scroll set 00062 #define SCSTART 0xAB // Scroll start set 00063 #define OSCON 0xD1 // Internal oscillation on 00064 #define OSCOFF 0xD2 // Internal oscillation off 00065 #define PWRCTR 0x20 // Power control 00066 #define VOLCTR 0x81 // Electronic volume control 00067 #define VOLUP 0xD6 // Increment electronic control by 1 00068 #define VOLDOWN 0xD7 // Decrement electronic control by 1 00069 #define TMPGRD 0x82 // Temperature gradient set 00070 #define EPCTIN 0xCD // Control EEPROM 00071 #define EPCOUT 0xCC // Cancel EEPROM control 00072 #define EPMWR 0xFC // Write into EEPROM 00073 #define EPMRD 0xFD // Read from EEPROM 00074 #define EPSRRD1 0x7C // Read register 1 00075 #define EPSRRD2 0x7D // Read register 2 00076 #define NOP 0x25 // NOP instruction 00077 00078 // backlight control 00079 #define BKLGHT_LCD_ON 1 00080 #define BKLGHT_LCD_OFF 2 00081 00082 // Booleans 00083 #define NOFILL 0 00084 #define FILL 1 00085 #define SMALL 0 00086 #define MEDIUM 1 00087 #define LARGE 2 00088 00089 // mask definitions 00090 #define BIT0 0x00000001 00091 #define BIT1 0x00000002 00092 #define BIT2 0x00000004 00093 #define BIT3 0x00000008 00094 #define BIT4 0x00000010 00095 #define BIT5 0x00000020 00096 #define BIT6 0x00000040 00097 #define BIT7 0x00000080 00098 #define BIT8 0x00000100 00099 #define BIT9 0x00000200 00100 #define BIT10 0x00000400 00101 #define BIT11 0x00000800 00102 #define BIT12 0x00001000 00103 #define BIT13 0x00002000 00104 #define BIT14 0x00004000 00105 #define BIT15 0x00008000 00106 #define BIT16 0x00010000 00107 #define BIT17 0x00020000 00108 #define BIT18 0x00040000 00109 #define BIT19 0x00080000 00110 #define BIT20 0x00100000 00111 #define BIT21 0x00200000 00112 #define BIT22 0x00400000 00113 #define BIT23 0x00800000 00114 #define BIT24 0x01000000 00115 #define BIT25 0x02000000 00116 #define BIT26 0x04000000 00117 #define BIT27 0x08000000 00118 #define BIT28 0x10000000 00119 #define BIT29 0x20000000 00120 #define BIT30 0x40000000 00121 #define BIT31 0x80000000 00122 00123 // 12-bit color definitions 00124 #define WHITE 0xFFFFFF 00125 #define BLACK 0x000000 00126 #define RED 0xFF0000 00127 #define GREEN 0x00FF00 00128 #define BLUE 0x0000FF 00129 #define CYAN 0x00FFFF 00130 #define MAGENTA 0xFF00FF 00131 #define YELLOW 0xFFFF00 00132 #define BROWN 0xBB2222 00133 #define ORANGE 0xFFAA00 00134 #define PINK 0xFF66AA 00135 00136 #endif // Lcd_h
Generated on Sun Jul 24 2022 09:45:58 by
1.7.2