Behrooz Abdi
/
Tiger_LCD
Landtiger (LPC1768) graphics LCD demo.
Diff: GLCD_LPC1700.cpp
- Revision:
- 1:ea0f7b1c5daf
- Parent:
- 0:a8090b59eb05
- Child:
- 2:43ede88fb5a3
--- a/GLCD_LPC1700.cpp Sun Nov 04 16:49:27 2012 +0000 +++ b/GLCD_LPC1700.cpp Sun Nov 04 18:13:01 2012 +0000 @@ -539,14 +539,8 @@ case SSD1289_ID: { //3.2" TFT LCD Module,DriverIC is SSD1289 - /* Set GRAM write direction and BGR = 1 - I/D=10 (Horizontal : increment, Vertical : increment) - AM=1 (address is updated in vertical writing direction) */ - wr_reg(0x03, 0x1038); - wr_reg(0x07, 0x0173); /* 262K color and display ON */ - -/// case SSD1289_ID: { //3.2" TFT LCD Module,DriverIC is SSD1289 - + wr_reg(0x0007,0x0233); delay(5); //0x0233 Set this first or init fails ! + wr_reg(0x0000,0x0001); delay(5); // osc en wr_reg(0x0003,0xA8A4); delay(5); // powercontrol 1 0xA8A4 @@ -1280,11 +1274,11 @@ void GLCD_DrawChar (unsigned int x, unsigned int y, unsigned short *c) { int idx = 0, i, j; - x = WIDTH-x-CHAR_W; +//wh x = WIDTH-x-CHAR_W; if(driverCode==0x8989) { - wr_reg(0x44, y); /* Horizontal GRAM Start Address */ +//wh wr_reg(0x44, y); /* Horizontal GRAM Start Address */ wr_reg(0x44, y |((y+CHAR_H-1)<<8)); /* Horizontal GRAM End Address (-1) */ wr_reg(0x45, x); /* Vertical GRAM Start Address */ wr_reg(0x46, x+CHAR_W-1); /* Vertical GRAM End Address (-1) */ @@ -1306,7 +1300,8 @@ wr_cmd(0x22); wr_dat_start(); for (j = 0; j < CHAR_H; j++) { - for (i = CHAR_W-1; i >= 0; i--) { +//wh for (i = CHAR_W-1; i >= 0; i--) { + for (i = 0; i < CHAR_W; i++) { if((c[idx] & (1 << i)) == 0x00) { wr_dat_only(BackColor); } else { @@ -1330,7 +1325,9 @@ void GLCD_DisplayChar (unsigned int ln, unsigned int col, unsigned char c) { c -= 32; + // x = column, y = line GLCD_DrawChar(col * CHAR_W, ln * CHAR_H, (unsigned short *)&Font_24x16[c * CHAR_H]); + } @@ -1570,11 +1567,11 @@ unsigned int i, j; unsigned short *bitmap_ptr = (unsigned short *)bmp; - x = WIDTH-x-w; +//wh x = WIDTH-x-w; if(driverCode==0x8989) { - wr_reg(0x44, y); /* Horizontal GRAM Start Address */ +//wh wr_reg(0x44, y); /* Horizontal GRAM Start Address */ wr_reg(0x44, y |((y+h-1)<<8)); /* Horizontal GRAM End Address (-1) */ wr_reg(0x45, x); /* Vertical GRAM Start Address */ wr_reg(0x46, x+w-1); /* Vertical GRAM End Address (-1) */ @@ -1593,12 +1590,21 @@ LCD_CS(0) wr_cmd(0x22); wr_dat_start(); - bitmap_ptr += (h*w)-1; +// bitmap_ptr += (h*w)-1; +// for (j = 0; j < h; j++) { +// for (i = 0; i < w; i++) { +// wr_dat_only(*bitmap_ptr--); +// } +// } + + for (j = 0; j < h; j++) { for (i = 0; i < w; i++) { - wr_dat_only(*bitmap_ptr--); + wr_dat_only(*bitmap_ptr++); } } + + wr_dat_stop(); }