Basically i glued Peter Drescher and Simon Ford libs in a GraphicsDisplay class, then derived TFT or LCD class (which inherits Protocols class), then the most derived ones (Inits), which are per-display and are the only part needed to be adapted to diff hw.

Dependents:   Brew

Committer:
dreschpe
Date:
Mon Oct 26 12:49:02 2015 +0000
Revision:
27:acb2594b8aa4
Parent:
25:daacdcf34e52
Child:
33:f87f06292637
fix handling of PAR8 / PAR16 includes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Geremia 4:12ba0ecc2c1f 1 /* mbed UniGraphic library - universal LCD driver class
Geremia 4:12ba0ecc2c1f 2 * Copyright (c) 2015 Giuliano Dianda
Geremia 4:12ba0ecc2c1f 3 * Released under the MIT License: http://mbed.org/license/mit
Geremia 4:12ba0ecc2c1f 4 *
Geremia 4:12ba0ecc2c1f 5 * Derived work of:
Geremia 4:12ba0ecc2c1f 6 *
Geremia 4:12ba0ecc2c1f 7 * mbed library for the mbed Lab Board 128*32 pixel LCD
Geremia 3:48f3282c2be8 8 * use C12832 controller
Geremia 3:48f3282c2be8 9 * Copyright (c) 2012 Peter Drescher - DC2PD
Geremia 3:48f3282c2be8 10 * Released under the MIT License: http://mbed.org/license/mit
Geremia 3:48f3282c2be8 11 *
Geremia 3:48f3282c2be8 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Geremia 3:48f3282c2be8 13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Geremia 3:48f3282c2be8 14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Geremia 3:48f3282c2be8 15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Geremia 3:48f3282c2be8 16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Geremia 3:48f3282c2be8 17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Geremia 3:48f3282c2be8 18 * THE SOFTWARE.
Geremia 3:48f3282c2be8 19 */
dreschpe 27:acb2594b8aa4 20 #include "platform.h"
dreschpe 27:acb2594b8aa4 21 #include "LCD.h"
Geremia 3:48f3282c2be8 22
dreschpe 27:acb2594b8aa4 23 #if DEVICE_PORTINOUT
dreschpe 27:acb2594b8aa4 24 #include "PAR8.h"
dreschpe 27:acb2594b8aa4 25 #include "PAR16.h"
dreschpe 27:acb2594b8aa4 26 #endif
Geremia 0:75ec1b3cde17 27
Geremia 0:75ec1b3cde17 28 //#include "mbed_debug.h"
Geremia 7:bb0383b91104 29
Geremia 0:75ec1b3cde17 30 #define SWAP(a, b) { a ^= b; b ^= a; a ^= b; }
Geremia 2:713844a55c4e 31
dreschpe 27:acb2594b8aa4 32 #if DEVICE_PORTINOUT
Geremia 0:75ec1b3cde17 33 LCD::LCD(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const int lcdsize_x, const int lcdsize_y, const int ic_x_segs, const int ic_y_coms, const char *name)
Geremia 7:bb0383b91104 34 : GraphicsDisplay(name), screensize_X(lcdsize_x), screensize_Y(lcdsize_y), _LCDPAGES(lcdsize_y>>3), _IC_X_SEGS(ic_x_segs), _IC_Y_COMS(ic_y_coms), _IC_PAGES(ic_y_coms>>3)
Geremia 0:75ec1b3cde17 35 {
dreschpe 27:acb2594b8aa4 36 if(displayproto==PAR_8) proto = new PAR8(port, CS, reset, DC, WR, RD);
Geremia 1:ff019d22b275 37 useNOP=false;
Geremia 7:bb0383b91104 38 buffer = (unsigned char*) malloc (screensize_X*_LCDPAGES);
Geremia 1:ff019d22b275 39 buffer16 = (unsigned short*)buffer;
Geremia 0:75ec1b3cde17 40 draw_mode = NORMAL;
Geremia 0:75ec1b3cde17 41 set_orientation(1);
Geremia 4:12ba0ecc2c1f 42 foreground(White);
Geremia 4:12ba0ecc2c1f 43 background(Black);
Geremia 2:713844a55c4e 44 set_auto_up(true);
Geremia 7:bb0383b91104 45 tftID=0;
Geremia 0:75ec1b3cde17 46 // cls();
Geremia 0:75ec1b3cde17 47 // locate(0,0);
Geremia 0:75ec1b3cde17 48 }
dreschpe 27:acb2594b8aa4 49 #endif
dreschpe 27:acb2594b8aa4 50
Geremia 21:ae0a4eedfc90 51 LCD::LCD(proto_t displayproto, PinName* buspins, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const int lcdsize_x, const int lcdsize_y, const int ic_x_segs, const int ic_y_coms, const char *name)
Geremia 21:ae0a4eedfc90 52 : GraphicsDisplay(name), screensize_X(lcdsize_x), screensize_Y(lcdsize_y), _LCDPAGES(lcdsize_y>>3), _IC_X_SEGS(ic_x_segs), _IC_Y_COMS(ic_y_coms), _IC_PAGES(ic_y_coms>>3)
Geremia 21:ae0a4eedfc90 53 {
Geremia 21:ae0a4eedfc90 54 if(displayproto==BUS_8)
Geremia 21:ae0a4eedfc90 55 {
Geremia 21:ae0a4eedfc90 56 PinName pins[16];
Geremia 21:ae0a4eedfc90 57 for(int i=0; i<16; i++) pins[i]=NC;
Geremia 21:ae0a4eedfc90 58 for(int i=0; i<8; i++) pins[i]=buspins[i];
Geremia 21:ae0a4eedfc90 59 proto = new BUS8(pins, CS, reset, DC, WR, RD);
Geremia 21:ae0a4eedfc90 60 }
Geremia 21:ae0a4eedfc90 61 useNOP=false;
Geremia 21:ae0a4eedfc90 62 buffer = (unsigned char*) malloc (screensize_X*_LCDPAGES);
Geremia 21:ae0a4eedfc90 63 buffer16 = (unsigned short*)buffer;
Geremia 21:ae0a4eedfc90 64 draw_mode = NORMAL;
Geremia 21:ae0a4eedfc90 65 set_orientation(1);
Geremia 21:ae0a4eedfc90 66 foreground(White);
Geremia 21:ae0a4eedfc90 67 background(Black);
Geremia 21:ae0a4eedfc90 68 set_auto_up(true);
Geremia 21:ae0a4eedfc90 69 tftID=0;
Geremia 21:ae0a4eedfc90 70 // cls();
Geremia 21:ae0a4eedfc90 71 // locate(0,0);
Geremia 21:ae0a4eedfc90 72 }
Geremia 1:ff019d22b275 73 LCD::LCD(proto_t displayproto, int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC, const int lcdsize_x, const int lcdsize_y, const int ic_x_segs, const int ic_y_coms, const char *name)
Geremia 7:bb0383b91104 74 : GraphicsDisplay(name), screensize_X(lcdsize_x), screensize_Y(lcdsize_y), _LCDPAGES(lcdsize_y>>3), _IC_X_SEGS(ic_x_segs), _IC_Y_COMS(ic_y_coms), _IC_PAGES(ic_y_coms>>3)
Geremia 0:75ec1b3cde17 75 {
Geremia 1:ff019d22b275 76 if(displayproto==SPI_8)
Geremia 1:ff019d22b275 77 {
Geremia 1:ff019d22b275 78 proto = new SPI8(Hz, mosi, miso, sclk, CS, reset, DC);
Geremia 1:ff019d22b275 79 useNOP=false;
Geremia 1:ff019d22b275 80 }
Geremia 1:ff019d22b275 81 else if(displayproto==SPI_16)
Geremia 1:ff019d22b275 82 {
Geremia 1:ff019d22b275 83 proto = new SPI16(Hz, mosi, miso, sclk, CS, reset, DC);
Geremia 1:ff019d22b275 84 useNOP=true;
Geremia 1:ff019d22b275 85 }
Geremia 7:bb0383b91104 86 buffer = (unsigned char*) malloc (screensize_X*_LCDPAGES);
Geremia 1:ff019d22b275 87 buffer16 = (unsigned short*)buffer;
Geremia 0:75ec1b3cde17 88 draw_mode = NORMAL;
Geremia 0:75ec1b3cde17 89 // cls();
Geremia 0:75ec1b3cde17 90 set_orientation(1);
Geremia 4:12ba0ecc2c1f 91 foreground(White);
Geremia 4:12ba0ecc2c1f 92 background(Black);
Geremia 2:713844a55c4e 93 set_auto_up(true);
Geremia 7:bb0383b91104 94 tftID=0;
Geremia 0:75ec1b3cde17 95 // locate(0,0);
Geremia 1:ff019d22b275 96
Geremia 0:75ec1b3cde17 97 }
Geremia 0:75ec1b3cde17 98 LCD::~LCD()
Geremia 0:75ec1b3cde17 99 {
Geremia 0:75ec1b3cde17 100 free(buffer);
Geremia 0:75ec1b3cde17 101 }
Geremia 0:75ec1b3cde17 102
Geremia 1:ff019d22b275 103 void LCD::wr_cmd8(unsigned char cmd)
Geremia 0:75ec1b3cde17 104 {
Geremia 2:713844a55c4e 105 if(useNOP) proto->wr_cmd16(0xE300|cmd); // E3 is NOP cmd for LCD
Geremia 1:ff019d22b275 106 else proto->wr_cmd8(cmd);
Geremia 0:75ec1b3cde17 107 }
Geremia 1:ff019d22b275 108 void LCD::wr_data8(unsigned char data)
Geremia 0:75ec1b3cde17 109 {
Geremia 1:ff019d22b275 110 proto->wr_data8(data);
Geremia 1:ff019d22b275 111 }
Geremia 1:ff019d22b275 112 void LCD::wr_cmd16(unsigned short cmd)
Geremia 1:ff019d22b275 113 {
Geremia 1:ff019d22b275 114 proto->wr_cmd16(cmd);
Geremia 0:75ec1b3cde17 115 }
Geremia 4:12ba0ecc2c1f 116 void LCD::wr_gram(unsigned short data, unsigned int count)
Geremia 0:75ec1b3cde17 117 {
Geremia 4:12ba0ecc2c1f 118 proto->wr_gram(data, count);
Geremia 1:ff019d22b275 119 }
Geremia 4:12ba0ecc2c1f 120 void LCD::wr_grambuf(unsigned short* data, unsigned int lenght)
Geremia 1:ff019d22b275 121 {
Geremia 4:12ba0ecc2c1f 122 proto->wr_grambuf(data, lenght);
Geremia 0:75ec1b3cde17 123 }
Geremia 0:75ec1b3cde17 124 void LCD::hw_reset()
Geremia 0:75ec1b3cde17 125 {
Geremia 0:75ec1b3cde17 126 proto->hw_reset();
Geremia 0:75ec1b3cde17 127 }
Geremia 0:75ec1b3cde17 128 void LCD::BusEnable(bool enable)
Geremia 0:75ec1b3cde17 129 {
Geremia 0:75ec1b3cde17 130 proto->BusEnable(enable);
Geremia 0:75ec1b3cde17 131 }
Geremia 0:75ec1b3cde17 132
Geremia 0:75ec1b3cde17 133
Geremia 0:75ec1b3cde17 134
Geremia 0:75ec1b3cde17 135 // monochrome LCD driver ICs does not have ram rotate in hw (swap raw<->columns) like TFT displays
Geremia 0:75ec1b3cde17 136 // for portrait views, XY swap will be done in sw in pixel() function
Geremia 0:75ec1b3cde17 137 void LCD::set_orientation(int o)
Geremia 0:75ec1b3cde17 138 {
Geremia 0:75ec1b3cde17 139 orientation = o;
Geremia 0:75ec1b3cde17 140 switch (o) {
Geremia 0:75ec1b3cde17 141 case (0):// portrait view -90°
Geremia 0:75ec1b3cde17 142 mirrorXY(Y);
Geremia 0:75ec1b3cde17 143 col_offset = 0;
Geremia 7:bb0383b91104 144 page_offset = _IC_PAGES-_LCDPAGES;
Geremia 7:bb0383b91104 145 set_width(screensize_Y);
Geremia 7:bb0383b91104 146 set_height(screensize_X);
Geremia 0:75ec1b3cde17 147 // portrait = true;
Geremia 0:75ec1b3cde17 148 break;
Geremia 0:75ec1b3cde17 149 case (1): // default, landscape view 0°
Geremia 0:75ec1b3cde17 150 mirrorXY(NONE);
Geremia 0:75ec1b3cde17 151 col_offset = 0;
Geremia 0:75ec1b3cde17 152 page_offset = 0;
Geremia 7:bb0383b91104 153 set_width(screensize_X);
Geremia 7:bb0383b91104 154 set_height(screensize_Y);
Geremia 0:75ec1b3cde17 155 // portrait = false;
Geremia 0:75ec1b3cde17 156 break;
Geremia 0:75ec1b3cde17 157 case (2):// portrait view +90°
Geremia 0:75ec1b3cde17 158 mirrorXY(X);
Geremia 7:bb0383b91104 159 col_offset = _IC_X_SEGS-screensize_X; // some displays have less pixels than IC ram
Geremia 0:75ec1b3cde17 160 page_offset = 0;
Geremia 7:bb0383b91104 161 set_width(screensize_Y);
Geremia 7:bb0383b91104 162 set_height(screensize_X);
Geremia 0:75ec1b3cde17 163 // portrait = true;
Geremia 0:75ec1b3cde17 164 break;
Geremia 0:75ec1b3cde17 165 case (3):// landscape view +180°
Geremia 0:75ec1b3cde17 166 mirrorXY(XY);
Geremia 7:bb0383b91104 167 col_offset = _IC_X_SEGS-screensize_X;
Geremia 7:bb0383b91104 168 page_offset = _IC_PAGES-_LCDPAGES;
Geremia 7:bb0383b91104 169 set_width(screensize_X);
Geremia 7:bb0383b91104 170 set_height(screensize_Y);
Geremia 0:75ec1b3cde17 171 // portrait = false;
Geremia 0:75ec1b3cde17 172 break;
Geremia 0:75ec1b3cde17 173 }
Geremia 0:75ec1b3cde17 174 }
Geremia 0:75ec1b3cde17 175 void LCD::mirrorXY(mirror_t mode)
Geremia 0:75ec1b3cde17 176 {
Geremia 0:75ec1b3cde17 177 switch (mode)
Geremia 0:75ec1b3cde17 178 {
Geremia 0:75ec1b3cde17 179 case(NONE):
Geremia 1:ff019d22b275 180 // wr_cmd8(0xA0);
Geremia 1:ff019d22b275 181 wr_cmd16(0xA0C8); // this is in real Y mirror command, but seems most displays have COMs wired inverted, so assume this is the default no-y-mirror
Geremia 0:75ec1b3cde17 182 break;
Geremia 0:75ec1b3cde17 183 case(X):
Geremia 1:ff019d22b275 184 // wr_cmd8(0xA1);
Geremia 1:ff019d22b275 185 wr_cmd16(0xA1C8);
Geremia 0:75ec1b3cde17 186 break;
Geremia 0:75ec1b3cde17 187 case(Y):
Geremia 1:ff019d22b275 188 // wr_cmd8(0xA0);
Geremia 1:ff019d22b275 189 wr_cmd16(0xA0C0);
Geremia 0:75ec1b3cde17 190 break;
Geremia 0:75ec1b3cde17 191 case(XY):
Geremia 1:ff019d22b275 192 // wr_cmd8(0xA1);
Geremia 1:ff019d22b275 193 wr_cmd16(0xA1C0);
Geremia 0:75ec1b3cde17 194 break;
Geremia 0:75ec1b3cde17 195 }
Geremia 0:75ec1b3cde17 196 }
Geremia 0:75ec1b3cde17 197 void LCD::invert(unsigned char o)
Geremia 0:75ec1b3cde17 198 {
Geremia 1:ff019d22b275 199 if(o == 0) wr_cmd8(0xA6);
Geremia 1:ff019d22b275 200 else wr_cmd8(0xA7);
Geremia 0:75ec1b3cde17 201 }
Geremia 0:75ec1b3cde17 202
Geremia 0:75ec1b3cde17 203 void LCD::set_contrast(int o)
Geremia 0:75ec1b3cde17 204 {
Geremia 0:75ec1b3cde17 205 contrast = o;
Geremia 1:ff019d22b275 206 // wr_cmd8(0x81); // set volume
Geremia 1:ff019d22b275 207 wr_cmd16(0x8100|(o&0x3F));
Geremia 0:75ec1b3cde17 208 }
Geremia 2:713844a55c4e 209
Geremia 0:75ec1b3cde17 210 int LCD::get_contrast(void)
Geremia 0:75ec1b3cde17 211 {
Geremia 0:75ec1b3cde17 212 return(contrast);
Geremia 0:75ec1b3cde17 213 }
Geremia 0:75ec1b3cde17 214 void LCD::window(int x, int y, int w, int h) {
Geremia 0:75ec1b3cde17 215 // current pixel location
Geremia 0:75ec1b3cde17 216 cur_x = x;
Geremia 0:75ec1b3cde17 217 cur_y = y;
Geremia 0:75ec1b3cde17 218 // window settings
Geremia 0:75ec1b3cde17 219 win_x1 = x;
Geremia 0:75ec1b3cde17 220 win_x2 = x + w - 1;
Geremia 0:75ec1b3cde17 221 win_y1 = y;
Geremia 0:75ec1b3cde17 222 win_y2 = y + h - 1;
Geremia 0:75ec1b3cde17 223 }
Geremia 0:75ec1b3cde17 224 void LCD::window_pushpixel(unsigned short color) {
Geremia 0:75ec1b3cde17 225 pixel(cur_x, cur_y, color);
Geremia 0:75ec1b3cde17 226 cur_x++;
Geremia 0:75ec1b3cde17 227 if(cur_x > win_x2) {
Geremia 0:75ec1b3cde17 228 cur_x = win_x1;
Geremia 0:75ec1b3cde17 229 cur_y++;
Geremia 0:75ec1b3cde17 230 if(cur_y > win_y2) {
Geremia 0:75ec1b3cde17 231 cur_y = win_y1;
Geremia 0:75ec1b3cde17 232 }
Geremia 0:75ec1b3cde17 233 }
Geremia 0:75ec1b3cde17 234 }
Geremia 2:713844a55c4e 235 void LCD::window_pushpixel(unsigned short color, unsigned int count) {
Geremia 2:713844a55c4e 236 while(count)
Geremia 2:713844a55c4e 237 {
Geremia 2:713844a55c4e 238 pixel(cur_x, cur_y, color);
Geremia 2:713844a55c4e 239 cur_x++;
Geremia 2:713844a55c4e 240 if(cur_x > win_x2)
Geremia 2:713844a55c4e 241 {
Geremia 2:713844a55c4e 242 cur_x = win_x1;
Geremia 2:713844a55c4e 243 cur_y++;
Geremia 2:713844a55c4e 244 if(cur_y > win_y2)
Geremia 2:713844a55c4e 245 {
Geremia 2:713844a55c4e 246 cur_y = win_y1;
Geremia 2:713844a55c4e 247 }
Geremia 2:713844a55c4e 248 }
Geremia 2:713844a55c4e 249 count--;
Geremia 2:713844a55c4e 250 }
Geremia 2:713844a55c4e 251 }
Geremia 2:713844a55c4e 252 void LCD::window_pushpixelbuf(unsigned short* color, unsigned int lenght) {
Geremia 2:713844a55c4e 253 while(lenght)
Geremia 2:713844a55c4e 254 {
Geremia 2:713844a55c4e 255 pixel(cur_x, cur_y, *color++);
Geremia 2:713844a55c4e 256 cur_x++;
Geremia 2:713844a55c4e 257 if(cur_x > win_x2)
Geremia 2:713844a55c4e 258 {
Geremia 2:713844a55c4e 259 cur_x = win_x1;
Geremia 2:713844a55c4e 260 cur_y++;
Geremia 2:713844a55c4e 261 if(cur_y > win_y2)
Geremia 2:713844a55c4e 262 {
Geremia 2:713844a55c4e 263 cur_y = win_y1;
Geremia 2:713844a55c4e 264 }
Geremia 2:713844a55c4e 265 }
Geremia 2:713844a55c4e 266 lenght--;
Geremia 2:713844a55c4e 267 }
Geremia 2:713844a55c4e 268 }
Geremia 0:75ec1b3cde17 269 void LCD::pixel(int x, int y, unsigned short color)
Geremia 0:75ec1b3cde17 270 {
Geremia 0:75ec1b3cde17 271 if(!(orientation&1)) SWAP(x,y);
Geremia 0:75ec1b3cde17 272 // first check parameter
Geremia 7:bb0383b91104 273 if((x >= screensize_X) || (y >= screensize_Y)) return;
Geremia 0:75ec1b3cde17 274
Geremia 20:14daa48ffd4c 275 if(color) buffer[(x + ((y>>3)*screensize_X))^1] &= ~(1 << (y&7)); // erase pixel
Geremia 20:14daa48ffd4c 276 else buffer[(x + ((y>>3)*screensize_X))^1] |= (1 << (y&7)); //Black=0000, set pixel
Geremia 20:14daa48ffd4c 277 }
Geremia 20:14daa48ffd4c 278 unsigned short LCD::pixelread(int x, int y)
Geremia 20:14daa48ffd4c 279 {
Geremia 20:14daa48ffd4c 280 if(!(orientation&1)) SWAP(x,y);
Geremia 20:14daa48ffd4c 281 // first check parameter
Geremia 20:14daa48ffd4c 282 if((x >= screensize_X) || (y >= screensize_Y)) return 0;
Geremia 20:14daa48ffd4c 283
Geremia 20:14daa48ffd4c 284 if((buffer[(x + ((y>>3)*screensize_X))^1] & (1 << (y&7)))==0) return 0xFFFF ; // pixel not set, White
Geremia 20:14daa48ffd4c 285 else return 0; // pixel set, Black
Geremia 0:75ec1b3cde17 286 }
Geremia 0:75ec1b3cde17 287 void LCD::copy_to_lcd(void)
Geremia 0:75ec1b3cde17 288 {
Geremia 0:75ec1b3cde17 289 unsigned short i=0;
Geremia 1:ff019d22b275 290 unsigned short setcolcmd = 0x0010 | ((col_offset&0xF)<<8) | (col_offset>>4);
Geremia 7:bb0383b91104 291 for(int page=0; page<_LCDPAGES; page++)
Geremia 0:75ec1b3cde17 292 {
Geremia 1:ff019d22b275 293 // wr_cmd8(col_offset&0xF); // set column low nibble
Geremia 1:ff019d22b275 294 // wr_cmd8(0x10|(col_offset>>4)); // set column hi nibble
Geremia 1:ff019d22b275 295 wr_cmd16(setcolcmd);
Geremia 1:ff019d22b275 296 wr_cmd8(0xB0|(page+page_offset)); // set page
Geremia 7:bb0383b91104 297 wr_grambuf(buffer16+i, screensize_X>>1); // send whole page pixels
Geremia 7:bb0383b91104 298 i+=screensize_X>>1;
Geremia 0:75ec1b3cde17 299 }
Geremia 0:75ec1b3cde17 300 }
Geremia 0:75ec1b3cde17 301 void LCD::cls(void)
Geremia 0:75ec1b3cde17 302 {
Geremia 4:12ba0ecc2c1f 303 unsigned short tmp = _background^0xFFFF;
Geremia 7:bb0383b91104 304 memset(buffer,tmp,screensize_X*_LCDPAGES); // clear display buffer
Geremia 1:ff019d22b275 305 unsigned short setcolcmd = 0x0010 | ((col_offset&0xF)<<8) | (col_offset>>4);
Geremia 7:bb0383b91104 306 for(int page=0; page<_LCDPAGES; page++)
Geremia 0:75ec1b3cde17 307 {
Geremia 1:ff019d22b275 308 // wr_cmd8((unsigned char)col_offset&0xF); // set column low nibble
Geremia 1:ff019d22b275 309 // wr_cmd8(0x10|(col_offset>>4)); // set column hi nibble
Geremia 1:ff019d22b275 310 wr_cmd16(setcolcmd);
Geremia 1:ff019d22b275 311 wr_cmd8(0xB0|(page+page_offset)); // set page
Geremia 18:ffa58f1a680a 312 wr_gram(tmp, screensize_X>>1); // send whole page pixels = background
Geremia 0:75ec1b3cde17 313 }
Geremia 7:bb0383b91104 314 }
Geremia 7:bb0383b91104 315 int LCD::sizeX()
Geremia 7:bb0383b91104 316 {
Geremia 7:bb0383b91104 317 return screensize_X;
Geremia 7:bb0383b91104 318 }
Geremia 7:bb0383b91104 319 int LCD::sizeY()
Geremia 7:bb0383b91104 320 {
Geremia 7:bb0383b91104 321 return screensize_Y;
Geremia 0:75ec1b3cde17 322 }