Arducam_UTFT_SPI_Library
Dependents: DigitalCamera_OV5642_WIZwiki-W7500 Prelude_OV5642_dev
UTFT_SPI.h@0:53f8d6b23687, 2015-10-29 (annotated)
- Committer:
- justinkim
- Date:
- Thu Oct 29 06:26:48 2015 +0000
- Revision:
- 0:53f8d6b23687
spi test failed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
justinkim | 0:53f8d6b23687 | 1 | /* |
justinkim | 0:53f8d6b23687 | 2 | UTFT_SPI.h - Arduino library support for Color TFT LCD Boards |
justinkim | 0:53f8d6b23687 | 3 | This is special porting for ArduCAM shield LCD screen. |
justinkim | 0:53f8d6b23687 | 4 | Use SPI bus interface and SSD1289 controller. Only work on |
justinkim | 0:53f8d6b23687 | 5 | ArduCAM shield Rev.C. |
justinkim | 0:53f8d6b23687 | 6 | For more information about ArduCAM shield please visit |
justinkim | 0:53f8d6b23687 | 7 | www.arducam.com |
justinkim | 0:53f8d6b23687 | 8 | Copyright (C)2010-2014 Henning Karlsen. All right reserved |
justinkim | 0:53f8d6b23687 | 9 | |
justinkim | 0:53f8d6b23687 | 10 | This library is the continuation of my ITDB02_Graph, ITDB02_Graph16 |
justinkim | 0:53f8d6b23687 | 11 | and RGB_GLCD libraries for Arduino and chipKit. As the number of |
justinkim | 0:53f8d6b23687 | 12 | supported display modules and controllers started to increase I felt |
justinkim | 0:53f8d6b23687 | 13 | it was time to make a single, universal library as it will be much |
justinkim | 0:53f8d6b23687 | 14 | easier to maintain in the future. |
justinkim | 0:53f8d6b23687 | 15 | |
justinkim | 0:53f8d6b23687 | 16 | Basic functionality of this library was origianlly based on the |
justinkim | 0:53f8d6b23687 | 17 | demo-code provided by ITead studio (for the ITDB02 modules) and |
justinkim | 0:53f8d6b23687 | 18 | NKC Electronics (for the RGB GLCD module/shield). |
justinkim | 0:53f8d6b23687 | 19 | |
justinkim | 0:53f8d6b23687 | 20 | This library supports a number of 8bit, 16bit and serial graphic |
justinkim | 0:53f8d6b23687 | 21 | displays, and will work with both Arduino and chipKit boards. For a |
justinkim | 0:53f8d6b23687 | 22 | full list of tested display modules and controllers, see the |
justinkim | 0:53f8d6b23687 | 23 | document UTFT_Supported_display_modules_&_controllers.pdf. |
justinkim | 0:53f8d6b23687 | 24 | |
justinkim | 0:53f8d6b23687 | 25 | When using 8bit and 16bit display modules there are some |
justinkim | 0:53f8d6b23687 | 26 | requirements you must adhere to. These requirements can be found |
justinkim | 0:53f8d6b23687 | 27 | in the document UTFT_Requirements.pdf. |
justinkim | 0:53f8d6b23687 | 28 | There are no special requirements when using serial displays. |
justinkim | 0:53f8d6b23687 | 29 | |
justinkim | 0:53f8d6b23687 | 30 | You can always find the latest version of the library at |
justinkim | 0:53f8d6b23687 | 31 | http://electronics.henningkarlsen.com/ |
justinkim | 0:53f8d6b23687 | 32 | |
justinkim | 0:53f8d6b23687 | 33 | If you make any modifications or improvements to the code, I would |
justinkim | 0:53f8d6b23687 | 34 | appreciate that you share the code with me so that I might include |
justinkim | 0:53f8d6b23687 | 35 | it in the next release. I can be contacted through |
justinkim | 0:53f8d6b23687 | 36 | http://electronics.henningkarlsen.com/contact.php. |
justinkim | 0:53f8d6b23687 | 37 | |
justinkim | 0:53f8d6b23687 | 38 | This library is free software; you can redistribute it and/or |
justinkim | 0:53f8d6b23687 | 39 | modify it under the terms of the GNU Lesser General Public |
justinkim | 0:53f8d6b23687 | 40 | License as published by the Free Software Foundation; either |
justinkim | 0:53f8d6b23687 | 41 | version 2.1 of the License, or (at your option) any later version. |
justinkim | 0:53f8d6b23687 | 42 | |
justinkim | 0:53f8d6b23687 | 43 | This library is distributed in the hope that it will be useful, |
justinkim | 0:53f8d6b23687 | 44 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
justinkim | 0:53f8d6b23687 | 45 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
justinkim | 0:53f8d6b23687 | 46 | Lesser General Public License for more details. |
justinkim | 0:53f8d6b23687 | 47 | |
justinkim | 0:53f8d6b23687 | 48 | You should have received a copy of the GNU Lesser General Public |
justinkim | 0:53f8d6b23687 | 49 | License along with this library; if not, write to the Free Software |
justinkim | 0:53f8d6b23687 | 50 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
justinkim | 0:53f8d6b23687 | 51 | */ |
justinkim | 0:53f8d6b23687 | 52 | |
justinkim | 0:53f8d6b23687 | 53 | #define UTFT_SPI_h |
justinkim | 0:53f8d6b23687 | 54 | |
justinkim | 0:53f8d6b23687 | 55 | #define UTFT_cbi(reg, bitmask) *reg &= ~bitmask |
justinkim | 0:53f8d6b23687 | 56 | #define UTFT_sbi(reg, bitmask) *reg |= bitmask |
justinkim | 0:53f8d6b23687 | 57 | |
justinkim | 0:53f8d6b23687 | 58 | #define cport(port, data) port &= data |
justinkim | 0:53f8d6b23687 | 59 | #define sport(port, data) port |= data |
justinkim | 0:53f8d6b23687 | 60 | |
justinkim | 0:53f8d6b23687 | 61 | #define swap(type, i, j) {type t = i; i = j; j = t;} |
justinkim | 0:53f8d6b23687 | 62 | |
justinkim | 0:53f8d6b23687 | 63 | #define fontbyte(x) cfont.font[x] |
justinkim | 0:53f8d6b23687 | 64 | |
justinkim | 0:53f8d6b23687 | 65 | #define pgm_read_word(data) *data |
justinkim | 0:53f8d6b23687 | 66 | #define pgm_read_byte(data) *data |
justinkim | 0:53f8d6b23687 | 67 | #define bitmapdatatype unsigned short* |
justinkim | 0:53f8d6b23687 | 68 | |
justinkim | 0:53f8d6b23687 | 69 | #define regtype volatile uint32_t |
justinkim | 0:53f8d6b23687 | 70 | #define regsize uint32_t |
justinkim | 0:53f8d6b23687 | 71 | |
justinkim | 0:53f8d6b23687 | 72 | #define LEFT 0 |
justinkim | 0:53f8d6b23687 | 73 | #define RIGHT 9999 |
justinkim | 0:53f8d6b23687 | 74 | #define CENTER 9998 |
justinkim | 0:53f8d6b23687 | 75 | |
justinkim | 0:53f8d6b23687 | 76 | #define PORTRAIT 0 |
justinkim | 0:53f8d6b23687 | 77 | #define LANDSCAPE 1 |
justinkim | 0:53f8d6b23687 | 78 | |
justinkim | 0:53f8d6b23687 | 79 | #define HX8347A 0 |
justinkim | 0:53f8d6b23687 | 80 | #define ILI9327 1 |
justinkim | 0:53f8d6b23687 | 81 | #define SSD1289 2 |
justinkim | 0:53f8d6b23687 | 82 | #define ILI9325C 3 |
justinkim | 0:53f8d6b23687 | 83 | #define ILI9325D_8 4 |
justinkim | 0:53f8d6b23687 | 84 | #define ILI9325D_16 5 |
justinkim | 0:53f8d6b23687 | 85 | #define HX8340B_8 6 |
justinkim | 0:53f8d6b23687 | 86 | #define HX8340B_S 7 |
justinkim | 0:53f8d6b23687 | 87 | #define HX8352A 8 |
justinkim | 0:53f8d6b23687 | 88 | #define ST7735 9 |
justinkim | 0:53f8d6b23687 | 89 | #define PCF8833 10 |
justinkim | 0:53f8d6b23687 | 90 | #define S1D19122 11 |
justinkim | 0:53f8d6b23687 | 91 | #define SSD1963_480 12 |
justinkim | 0:53f8d6b23687 | 92 | #define SSD1963_800 13 |
justinkim | 0:53f8d6b23687 | 93 | #define S6D1121_8 14 |
justinkim | 0:53f8d6b23687 | 94 | #define S6D1121_16 15 |
justinkim | 0:53f8d6b23687 | 95 | #define SSD1289LATCHED 16 |
justinkim | 0:53f8d6b23687 | 96 | //#define NOT_IN_USE 17 |
justinkim | 0:53f8d6b23687 | 97 | //#define NOT_IN_USE 18 |
justinkim | 0:53f8d6b23687 | 98 | #define SSD1289_8 19 |
justinkim | 0:53f8d6b23687 | 99 | #define SSD1963_800ALT 20 |
justinkim | 0:53f8d6b23687 | 100 | #define ILI9481 21 |
justinkim | 0:53f8d6b23687 | 101 | #define ILI9325D_16ALT 22 |
justinkim | 0:53f8d6b23687 | 102 | #define S6D0164 23 |
justinkim | 0:53f8d6b23687 | 103 | #define ST7735S 24 |
justinkim | 0:53f8d6b23687 | 104 | #define ILI9341_S5P 25 |
justinkim | 0:53f8d6b23687 | 105 | #define ILI9341_S4P 26 |
justinkim | 0:53f8d6b23687 | 106 | #define R61581 27 |
justinkim | 0:53f8d6b23687 | 107 | #define ILI9486 28 |
justinkim | 0:53f8d6b23687 | 108 | #define CPLD 29 |
justinkim | 0:53f8d6b23687 | 109 | #define HX8353C 30 |
justinkim | 0:53f8d6b23687 | 110 | #define ST7735_ALT 31 |
justinkim | 0:53f8d6b23687 | 111 | |
justinkim | 0:53f8d6b23687 | 112 | #define ITDB32 0 // HX8347-A (16bit) |
justinkim | 0:53f8d6b23687 | 113 | #define ITDB32WC 1 // ILI9327 (16bit) |
justinkim | 0:53f8d6b23687 | 114 | #define TFT01_32W 1 // ILI9327 (16bit) |
justinkim | 0:53f8d6b23687 | 115 | #define ITDB32S 2 // SSD1289 (16bit) |
justinkim | 0:53f8d6b23687 | 116 | #define TFT01_32 2 // SSD1289 (16bit) |
justinkim | 0:53f8d6b23687 | 117 | #define CTE32 2 // SSD1289 (16bit) |
justinkim | 0:53f8d6b23687 | 118 | #define ITDB24 3 // ILI9325C (8bit) |
justinkim | 0:53f8d6b23687 | 119 | #define ITDB24D 4 // ILI9325D (8bit) |
justinkim | 0:53f8d6b23687 | 120 | #define ITDB24DWOT 4 // ILI9325D (8bit) |
justinkim | 0:53f8d6b23687 | 121 | #define ITDB28 4 // ILI9325D (8bit) |
justinkim | 0:53f8d6b23687 | 122 | #define TFT01_24_8 4 // ILI9325D (8bit) |
justinkim | 0:53f8d6b23687 | 123 | #define DMTFT24104 4 // ILI9325D (8bit) |
justinkim | 0:53f8d6b23687 | 124 | #define DMTFT28103 4 // ILI9325D (8bit) |
justinkim | 0:53f8d6b23687 | 125 | #define TFT01_24_16 5 // ILI9325D (16bit) |
justinkim | 0:53f8d6b23687 | 126 | #define ITDB22 6 // HX8340-B (8bit) |
justinkim | 0:53f8d6b23687 | 127 | #define ITDB22SP 7 // HX8340-B (Serial 4Pin) |
justinkim | 0:53f8d6b23687 | 128 | #define ITDB32WD 8 // HX8352-A (16bit) |
justinkim | 0:53f8d6b23687 | 129 | #define TFT01_32WD 8 // HX8352-A (16bit) |
justinkim | 0:53f8d6b23687 | 130 | #define CTE32W 8 // HX8352-A (16bit) |
justinkim | 0:53f8d6b23687 | 131 | #define ITDB18SP 9 // ST7735 (Serial 5Pin) |
justinkim | 0:53f8d6b23687 | 132 | #define LPH9135 10 // PCF8833 (Serial 5Pin) |
justinkim | 0:53f8d6b23687 | 133 | #define ITDB25H 11 // S1D19122 (16bit) |
justinkim | 0:53f8d6b23687 | 134 | #define ITDB43 12 // SSD1963 (16bit) 480x272 |
justinkim | 0:53f8d6b23687 | 135 | #define TFT01_43 12 // SSD1963 (16bit) 480x272 |
justinkim | 0:53f8d6b23687 | 136 | #define ITDB50 13 // SSD1963 (16bit) 800x480 |
justinkim | 0:53f8d6b23687 | 137 | #define TFT01_50 13 // SSD1963 (16bit) 800x480 |
justinkim | 0:53f8d6b23687 | 138 | #define CTE50 13 // SSD1963 (16bit) 800x480 |
justinkim | 0:53f8d6b23687 | 139 | #define EHOUSE50 13 // SSD1963 (16bit) 800x480 |
justinkim | 0:53f8d6b23687 | 140 | #define ITDB24E_8 14 // S6D1121 (8bit) |
justinkim | 0:53f8d6b23687 | 141 | #define TFT01_24R2 14 // S6D1121 (8bit) |
justinkim | 0:53f8d6b23687 | 142 | #define ITDB24E_16 15 // S6D1121 (16bit) |
justinkim | 0:53f8d6b23687 | 143 | #define INFINIT32 16 // SSD1289 (Latched 16bit) -- Legacy, will be removed later |
justinkim | 0:53f8d6b23687 | 144 | #define ELEE32_REVA 16 // SSD1289 (Latched 16bit) |
justinkim | 0:53f8d6b23687 | 145 | //#define NOT_IN_USE 17 |
justinkim | 0:53f8d6b23687 | 146 | //#define NOT_IN_USE 18 |
justinkim | 0:53f8d6b23687 | 147 | #define ELEE32_REVB 19 // SSD1289 (8bit) |
justinkim | 0:53f8d6b23687 | 148 | #define TFT01_70 20 // SSD1963 (16bit) 800x480 Alternative Init |
justinkim | 0:53f8d6b23687 | 149 | #define CTE70 20 // SSD1963 (16bit) 800x480 Alternative Init |
justinkim | 0:53f8d6b23687 | 150 | #define EHOUSE70 20 // SSD1963 (16bit) 800x480 Alternative Init |
justinkim | 0:53f8d6b23687 | 151 | #define CTE32HR 21 // ILI9481 (16bit) |
justinkim | 0:53f8d6b23687 | 152 | #define CTE28 22 // ILI9325D (16bit) Alternative Init |
justinkim | 0:53f8d6b23687 | 153 | #define TFT01_28 22 // ILI9325D (16bit) Alternative Init |
justinkim | 0:53f8d6b23687 | 154 | #define CTE22 23 // S6D0164 (8bit) |
justinkim | 0:53f8d6b23687 | 155 | #define TFT01_22 23 // S6D0164 (8bit) |
justinkim | 0:53f8d6b23687 | 156 | #define DMTFT22102 23 // S6D0164 (8bit) |
justinkim | 0:53f8d6b23687 | 157 | #define TFT01_18SP 24 // ST7735S (Serial 5Pin) |
justinkim | 0:53f8d6b23687 | 158 | #define TFT01_22SP 25 // ILI9341 (Serial 5Pin) |
justinkim | 0:53f8d6b23687 | 159 | #define TFT01_24SP 25 // ILI9341 (Serial 5Pin) |
justinkim | 0:53f8d6b23687 | 160 | #define TFT22SHLD 25 // ILI9341 (Serial 5Pin) |
justinkim | 0:53f8d6b23687 | 161 | #define DMTFT28105 25 // ILI9341 (Serial 5Pin) |
justinkim | 0:53f8d6b23687 | 162 | #define MI0283QT9 26 // ILI9341 (Serial 4Pin) |
justinkim | 0:53f8d6b23687 | 163 | #define CTE35IPS 27 // R61581 (16bit) |
justinkim | 0:53f8d6b23687 | 164 | #define CTE40 28 // ILI9486 (16bit) |
justinkim | 0:53f8d6b23687 | 165 | #define EHOUSE50CPLD 29 // CPLD (16bit) |
justinkim | 0:53f8d6b23687 | 166 | #define CTE50CPLD 29 // CPLD (16bit) |
justinkim | 0:53f8d6b23687 | 167 | #define CTE70CPLD 29 // CPLD (16bit) |
justinkim | 0:53f8d6b23687 | 168 | #define DMTFT18101 30 // HX8353C (Serial 5Pin) |
justinkim | 0:53f8d6b23687 | 169 | #define TFT18SHLD 31 // ST7735 (Serial 5Pin) Alternative Init |
justinkim | 0:53f8d6b23687 | 170 | |
justinkim | 0:53f8d6b23687 | 171 | #define SERIAL_4PIN 4 |
justinkim | 0:53f8d6b23687 | 172 | #define SERIAL_5PIN 5 |
justinkim | 0:53f8d6b23687 | 173 | #define LATCHED_16 17 |
justinkim | 0:53f8d6b23687 | 174 | |
justinkim | 0:53f8d6b23687 | 175 | #define NOTINUSE 255 |
justinkim | 0:53f8d6b23687 | 176 | |
justinkim | 0:53f8d6b23687 | 177 | //********************************* |
justinkim | 0:53f8d6b23687 | 178 | // COLORS |
justinkim | 0:53f8d6b23687 | 179 | //********************************* |
justinkim | 0:53f8d6b23687 | 180 | // VGA color palette |
justinkim | 0:53f8d6b23687 | 181 | #define VGA_BLACK 0x0000 |
justinkim | 0:53f8d6b23687 | 182 | #define VGA_WHITE 0xFFFF |
justinkim | 0:53f8d6b23687 | 183 | #define VGA_RED 0xF800 |
justinkim | 0:53f8d6b23687 | 184 | #define VGA_GREEN 0x0400 |
justinkim | 0:53f8d6b23687 | 185 | #define VGA_BLUE 0x001F |
justinkim | 0:53f8d6b23687 | 186 | #define VGA_SILVER 0xC618 |
justinkim | 0:53f8d6b23687 | 187 | #define VGA_GRAY 0x8410 |
justinkim | 0:53f8d6b23687 | 188 | #define VGA_MAROON 0x8000 |
justinkim | 0:53f8d6b23687 | 189 | #define VGA_YELLOW 0xFFE0 |
justinkim | 0:53f8d6b23687 | 190 | #define VGA_OLIVE 0x8400 |
justinkim | 0:53f8d6b23687 | 191 | #define VGA_LIME 0x07E0 |
justinkim | 0:53f8d6b23687 | 192 | #define VGA_AQUA 0x07FF |
justinkim | 0:53f8d6b23687 | 193 | #define VGA_TEAL 0x0410 |
justinkim | 0:53f8d6b23687 | 194 | #define VGA_NAVY 0x0010 |
justinkim | 0:53f8d6b23687 | 195 | #define VGA_FUCHSIA 0xF81F |
justinkim | 0:53f8d6b23687 | 196 | #define VGA_PURPLE 0x8010 |
justinkim | 0:53f8d6b23687 | 197 | #define VGA_TRANSPARENT 0xFFFFFFFF |
justinkim | 0:53f8d6b23687 | 198 | |
justinkim | 0:53f8d6b23687 | 199 | #define BMPIMAGEOFFSET 66 |
justinkim | 0:53f8d6b23687 | 200 | |
justinkim | 0:53f8d6b23687 | 201 | struct _current_font |
justinkim | 0:53f8d6b23687 | 202 | { |
justinkim | 0:53f8d6b23687 | 203 | uint8_t* font; |
justinkim | 0:53f8d6b23687 | 204 | uint8_t x_size; |
justinkim | 0:53f8d6b23687 | 205 | uint8_t y_size; |
justinkim | 0:53f8d6b23687 | 206 | uint8_t offset; |
justinkim | 0:53f8d6b23687 | 207 | uint8_t numchars; |
justinkim | 0:53f8d6b23687 | 208 | }; |
justinkim | 0:53f8d6b23687 | 209 | |
justinkim | 0:53f8d6b23687 | 210 | class ArduLCD |
justinkim | 0:53f8d6b23687 | 211 | { |
justinkim | 0:53f8d6b23687 | 212 | public: |
justinkim | 0:53f8d6b23687 | 213 | ArduLCD(PinName mosi, PinName miso, PinName sck, PinName cs); |
justinkim | 0:53f8d6b23687 | 214 | void InitLCD(uint8_t orientation=LANDSCAPE); |
justinkim | 0:53f8d6b23687 | 215 | void clrScr(); |
justinkim | 0:53f8d6b23687 | 216 | void drawPixel(int x, int y); |
justinkim | 0:53f8d6b23687 | 217 | void drawLine(int x1, int y1, int x2, int y2); |
justinkim | 0:53f8d6b23687 | 218 | void fillScr(uint8_t r, uint8_t g, uint8_t b); |
justinkim | 0:53f8d6b23687 | 219 | void fillScr(uint16_t color); |
justinkim | 0:53f8d6b23687 | 220 | void drawRect(int x1, int y1, int x2, int y2); |
justinkim | 0:53f8d6b23687 | 221 | void drawRoundRect(int x1, int y1, int x2, int y2); |
justinkim | 0:53f8d6b23687 | 222 | void fillRect(int x1, int y1, int x2, int y2); |
justinkim | 0:53f8d6b23687 | 223 | void fillRoundRect(int x1, int y1, int x2, int y2); |
justinkim | 0:53f8d6b23687 | 224 | void drawCircle(int x, int y, int radius); |
justinkim | 0:53f8d6b23687 | 225 | void fillCircle(int x, int y, int radius); |
justinkim | 0:53f8d6b23687 | 226 | void setColor(uint8_t r, uint8_t g, uint8_t b); |
justinkim | 0:53f8d6b23687 | 227 | void setColor(uint16_t color); |
justinkim | 0:53f8d6b23687 | 228 | uint16_t getColor(); |
justinkim | 0:53f8d6b23687 | 229 | void setBackColor(uint8_t r, uint8_t g, uint8_t b); |
justinkim | 0:53f8d6b23687 | 230 | void setBackColor(uint32_t color); |
justinkim | 0:53f8d6b23687 | 231 | uint16_t getBackColor(); |
justinkim | 0:53f8d6b23687 | 232 | /* void printNumI(long num, int x, int y, int length=0, char filler=' '); |
justinkim | 0:53f8d6b23687 | 233 | void printNumF(double num, uint8_t dec, int x, int y, char divider='.', int length=0, char filler=' '); |
justinkim | 0:53f8d6b23687 | 234 | void setFont(uint8_t* font); |
justinkim | 0:53f8d6b23687 | 235 | uint8_t* getFont(); |
justinkim | 0:53f8d6b23687 | 236 | uint8_t getFontXsize(); |
justinkim | 0:53f8d6b23687 | 237 | uint8_t getFontYsize();*/ |
justinkim | 0:53f8d6b23687 | 238 | void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int scale=1); |
justinkim | 0:53f8d6b23687 | 239 | void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int deg, int rox, int roy); |
justinkim | 0:53f8d6b23687 | 240 | int getDisplayXSize(); |
justinkim | 0:53f8d6b23687 | 241 | int getDisplayYSize(); |
justinkim | 0:53f8d6b23687 | 242 | |
justinkim | 0:53f8d6b23687 | 243 | //***********not use***************** |
justinkim | 0:53f8d6b23687 | 244 | void lcdOff(); |
justinkim | 0:53f8d6b23687 | 245 | void lcdOn(); |
justinkim | 0:53f8d6b23687 | 246 | void setContrast(char c); |
justinkim | 0:53f8d6b23687 | 247 | void setBrightness(uint8_t br); |
justinkim | 0:53f8d6b23687 | 248 | void setDisplayPage(uint8_t page); |
justinkim | 0:53f8d6b23687 | 249 | void setWritePage(uint8_t page); |
justinkim | 0:53f8d6b23687 | 250 | //*********************************** |
justinkim | 0:53f8d6b23687 | 251 | |
justinkim | 0:53f8d6b23687 | 252 | int bus_write(int address, int value); |
justinkim | 0:53f8d6b23687 | 253 | uint8_t bus_read(int address); |
justinkim | 0:53f8d6b23687 | 254 | |
justinkim | 0:53f8d6b23687 | 255 | //void dispBitmap(File inFile); |
justinkim | 0:53f8d6b23687 | 256 | |
justinkim | 0:53f8d6b23687 | 257 | /* |
justinkim | 0:53f8d6b23687 | 258 | The functions and variables below should not normally be used. |
justinkim | 0:53f8d6b23687 | 259 | They have been left publicly available for use in add-on libraries |
justinkim | 0:53f8d6b23687 | 260 | */ |
justinkim | 0:53f8d6b23687 | 261 | uint8_t fch, fcl, bch, bcl; |
justinkim | 0:53f8d6b23687 | 262 | uint8_t orient; |
justinkim | 0:53f8d6b23687 | 263 | uint8_t model; |
justinkim | 0:53f8d6b23687 | 264 | long disp_x_size, disp_y_size; |
justinkim | 0:53f8d6b23687 | 265 | uint8_t display_model, display_transfer_mode, display_serial_mode; |
justinkim | 0:53f8d6b23687 | 266 | regtype *P_RS, *P_WR, *P_CS, *P_RST, *P_SDA, *P_SCL, *P_ALE; |
justinkim | 0:53f8d6b23687 | 267 | regsize B_RS, B_WR, B_CS, B_RST, B_SDA, B_SCL, B_ALE; |
justinkim | 0:53f8d6b23687 | 268 | uint8_t __p1, __p2, __p3, __p4, __p5; |
justinkim | 0:53f8d6b23687 | 269 | _current_font cfont; |
justinkim | 0:53f8d6b23687 | 270 | bool _transparent; |
justinkim | 0:53f8d6b23687 | 271 | |
justinkim | 0:53f8d6b23687 | 272 | void LCD_Writ_Bus(char VH,char VL); |
justinkim | 0:53f8d6b23687 | 273 | void LCD_Write_COM(char VL); |
justinkim | 0:53f8d6b23687 | 274 | void LCD_Write_DATA(char VH,char VL); |
justinkim | 0:53f8d6b23687 | 275 | void LCD_Write_COM_DATA(char com1,int dat1); |
justinkim | 0:53f8d6b23687 | 276 | void setPixel(uint16_t color); |
justinkim | 0:53f8d6b23687 | 277 | void drawHLine(int x, int y, int l); |
justinkim | 0:53f8d6b23687 | 278 | void drawVLine(int x, int y, int l); |
justinkim | 0:53f8d6b23687 | 279 | // void printChar(uint8_t c, int x, int y); |
justinkim | 0:53f8d6b23687 | 280 | void setXY(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); |
justinkim | 0:53f8d6b23687 | 281 | void clrXY(); |
justinkim | 0:53f8d6b23687 | 282 | void resetXY(); |
justinkim | 0:53f8d6b23687 | 283 | // void rotateChar(uint8_t c, int x, int y, int pos, int deg); |
justinkim | 0:53f8d6b23687 | 284 | void _set_direction_registers(uint8_t mode); |
justinkim | 0:53f8d6b23687 | 285 | void _fast_fill_16(int ch, int cl, long pix); |
justinkim | 0:53f8d6b23687 | 286 | void _fast_fill_8(int ch, long pix); |
justinkim | 0:53f8d6b23687 | 287 | void _convert_float(char *buf, double num, int width, uint8_t prec); |
justinkim | 0:53f8d6b23687 | 288 | |
justinkim | 0:53f8d6b23687 | 289 | protected: |
justinkim | 0:53f8d6b23687 | 290 | SPI spi; // does SPI MOSI, MISO and SCK |
justinkim | 0:53f8d6b23687 | 291 | DigitalOut _cs; // does SPI CE |
justinkim | 0:53f8d6b23687 | 292 | }; |
justinkim | 0:53f8d6b23687 | 293 |