diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-01-04 21:35:31 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-01-04 21:35:31 +0000 |
commit | 3992f18982d20750b5056ef255c02c746e336d2e (patch) | |
tree | a757862b183d8d3b3e25a547ec0ec912fb03f5d5 /firmware/target/arm/as3525 | |
parent | 98fa13cb29d9e26d9eac64096c37f8875b347b77 (diff) | |
download | rockbox-3992f18982d20750b5056ef255c02c746e336d2e.tar.gz rockbox-3992f18982d20750b5056ef255c02c746e336d2e.zip |
Sansa e200v2: LCD
- Cosmetics change to reduce the diff with lcd-fuze.c:
- remove useless headers
- move/remove/change comments
- rename functions
- fix casts
Now the differences with fuze lcd code are mostly:
- lcd_window* code
- _display_on() / as3525_dbop_init()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24182 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525')
-rw-r--r-- | firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c | 164 |
1 files changed, 70 insertions, 94 deletions
diff --git a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c index f48861f4d7..79914e2e44 100644 --- a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c +++ b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c | |||
@@ -22,23 +22,14 @@ | |||
22 | 22 | ||
23 | #include "cpu.h" | 23 | #include "cpu.h" |
24 | #include "lcd.h" | 24 | #include "lcd.h" |
25 | #include "kernel.h" | ||
26 | #include "thread.h" | ||
27 | #include <string.h> | ||
28 | #include <stdlib.h> | ||
29 | #include "file.h" | 25 | #include "file.h" |
30 | #include "debug.h" | 26 | #include "debug.h" |
31 | #include "system.h" | 27 | #include "system.h" |
32 | #include "font.h" | ||
33 | #include "bidi.h" | ||
34 | #include "clock-target.h" | 28 | #include "clock-target.h" |
35 | 29 | ||
30 | /* The controller is unknown, but some registers appear to be the same as the | ||
31 | HD66789R */ | ||
36 | static bool display_on = false; /* is the display turned on? */ | 32 | static bool display_on = false; /* is the display turned on? */ |
37 | static bool display_flipped = false; | ||
38 | /* we need to write a red pixel for correct button reads | ||
39 | * (see lcd_button_support()), but that must not happen while the lcd is | ||
40 | * updating so block lcd_button_support the during updates */ | ||
41 | static volatile bool lcd_busy = false; | ||
42 | 33 | ||
43 | /* register defines */ | 34 | /* register defines */ |
44 | #define R_START_OSC 0x00 | 35 | #define R_START_OSC 0x00 |
@@ -98,6 +89,8 @@ static unsigned short r_entry_mode = R_ENTRY_MODE_HORZ_NORMAL; | |||
98 | #define R_DISP_CONTROL_REV 0x0000 | 89 | #define R_DISP_CONTROL_REV 0x0000 |
99 | static unsigned short r_disp_control_rev = R_DISP_CONTROL_NORMAL; | 90 | static unsigned short r_disp_control_rev = R_DISP_CONTROL_NORMAL; |
100 | 91 | ||
92 | static volatile bool lcd_busy = false; | ||
93 | |||
101 | static inline void lcd_delay(int x) | 94 | static inline void lcd_delay(int x) |
102 | { | 95 | { |
103 | do { | 96 | do { |
@@ -105,31 +98,30 @@ static inline void lcd_delay(int x) | |||
105 | } while (x--); | 98 | } while (x--); |
106 | } | 99 | } |
107 | 100 | ||
108 | /* DBOP initialisation, do what OF does */ | 101 | static void as3525_dbop_init(void) |
109 | static void ams3525_dbop_init(void) | ||
110 | { | 102 | { |
111 | CGU_DBOP = (1<<3) | AS3525_DBOP_DIV; | 103 | CGU_DBOP = (1<<3) | AS3525_DBOP_DIV; |
112 | 104 | ||
113 | DBOP_TIMPOL_01 = 0xe167e167; | 105 | DBOP_TIMPOL_01 = 0xe167e167; |
114 | DBOP_TIMPOL_23 = 0xe167006e; | 106 | DBOP_TIMPOL_23 = 0xe167006e; |
115 | 107 | ||
116 | /* short count, 16bit write, read-timing =8 */ | 108 | /* short count: 16 | output data width: 16 | readstrobe line */ |
117 | DBOP_CTRL = (1<<18)|(1<<12)|(8<<0); | 109 | DBOP_CTRL = (1<<18|1<<12|1<<3); |
118 | 110 | ||
119 | GPIOB_AFSEL = 0xfc; | 111 | GPIOB_AFSEL = 0xfc; |
120 | GPIOC_AFSEL = 0xff; | 112 | GPIOC_AFSEL = 0xff; |
121 | 113 | ||
122 | DBOP_TIMPOL_23 = 0x6000e; | 114 | DBOP_TIMPOL_23 = 0x6000e; |
123 | 115 | ||
124 | /* short count,write enable, 16bit write, read-timing =8 */ | 116 | /* short count: 16|enable write|output data width: 16|read strobe line */ |
125 | DBOP_CTRL = (1<<18)|(1<<16)|(1<<12)|(8<<0); | 117 | DBOP_CTRL = (1<<18|1<<16|1<<12|1<<3); |
126 | DBOP_TIMPOL_01 = 0x6e167; | 118 | DBOP_TIMPOL_01 = 0x6e167; |
127 | DBOP_TIMPOL_23 = 0xa167e06f; | 119 | DBOP_TIMPOL_23 = 0xa167e06f; |
128 | 120 | ||
129 | /* TODO: The OF calls some other functions here, but maybe not important */ | 121 | /* TODO: The OF calls some other functions here, but maybe not important */ |
130 | } | 122 | } |
131 | 123 | ||
132 | static void lcd_write_single_data16(unsigned short value) | 124 | static void lcd_write_value16(unsigned short value) |
133 | { | 125 | { |
134 | DBOP_CTRL &= ~(1<<14|1<<13); | 126 | DBOP_CTRL &= ~(1<<14|1<<13); |
135 | lcd_delay(10); | 127 | lcd_delay(10); |
@@ -141,13 +133,13 @@ static void lcd_write_cmd(int cmd) | |||
141 | { | 133 | { |
142 | /* Write register */ | 134 | /* Write register */ |
143 | DBOP_TIMPOL_23 = 0xa167006e; | 135 | DBOP_TIMPOL_23 = 0xa167006e; |
144 | lcd_write_single_data16(cmd); | 136 | lcd_write_value16(cmd); |
145 | 137 | ||
146 | /* Wait for fifo to empty */ | 138 | /* Wait for fifo to empty */ |
147 | while ((DBOP_STAT & (1<<10)) == 0); | 139 | while ((DBOP_STAT & (1<<10)) == 0); |
148 | 140 | ||
149 | /* Fuze OF has this loop and it seems to help us now also */ | 141 | /* Fuze OF has this loop and it seems to help us now also */ |
150 | int delay=8; | 142 | int delay = 8; |
151 | while(delay--); | 143 | while(delay--); |
152 | 144 | ||
153 | DBOP_TIMPOL_23 = 0xa167e06f; | 145 | DBOP_TIMPOL_23 = 0xa167e06f; |
@@ -157,14 +149,14 @@ void lcd_write_data(const fb_data* p_bytes, int count) | |||
157 | { | 149 | { |
158 | const long *data; | 150 | const long *data; |
159 | if ((int)p_bytes & 0x3) | 151 | if ((int)p_bytes & 0x3) |
160 | { /* need to do a single 16bit write beforehand if the address is */ | 152 | { /* need to do a single 16bit write beforehand if the address is |
161 | /* not word aligned*/ | 153 | * not word aligned */ |
162 | lcd_write_single_data16(*p_bytes); | 154 | lcd_write_value16(*p_bytes); |
163 | count--;p_bytes++; | 155 | count--;p_bytes++; |
164 | } | 156 | } |
165 | /* from here, 32bit transfers are save */ | 157 | /* from here, 32bit transfers are save |
166 | /* set it to transfer 4*(outputwidth) units at a time, */ | 158 | * set it to transfer 4*(outputwidth) units at a time, |
167 | /* if bit 12 is set it only does 2 halfwords though */ | 159 | * if bit 12 is set it only does 2 halfwords though */ |
168 | DBOP_CTRL |= (1<<13|1<<14); | 160 | DBOP_CTRL |= (1<<13|1<<14); |
169 | data = (long*)p_bytes; | 161 | data = (long*)p_bytes; |
170 | while (count > 1) | 162 | while (count > 1) |
@@ -181,7 +173,7 @@ void lcd_write_data(const fb_data* p_bytes, int count) | |||
181 | /* due to the 32bit alignment requirement or uneven count, | 173 | /* due to the 32bit alignment requirement or uneven count, |
182 | * we possibly need to do a 16bit transfer at the end also */ | 174 | * we possibly need to do a 16bit transfer at the end also */ |
183 | if (count > 0) | 175 | if (count > 0) |
184 | lcd_write_single_data16(*(fb_data*)data); | 176 | lcd_write_value16(*(fb_data*)data); |
185 | } | 177 | } |
186 | 178 | ||
187 | static void lcd_write_reg(int reg, int value) | 179 | static void lcd_write_reg(int reg, int value) |
@@ -189,7 +181,7 @@ static void lcd_write_reg(int reg, int value) | |||
189 | fb_data data = value; | 181 | fb_data data = value; |
190 | 182 | ||
191 | lcd_write_cmd(reg); | 183 | lcd_write_cmd(reg); |
192 | lcd_write_single_data16(data); | 184 | lcd_write_value16(data); |
193 | } | 185 | } |
194 | 186 | ||
195 | /*** hardware configuration ***/ | 187 | /*** hardware configuration ***/ |
@@ -211,6 +203,8 @@ void lcd_set_invert_display(bool yesno) | |||
211 | 203 | ||
212 | } | 204 | } |
213 | 205 | ||
206 | static bool display_flipped = false; | ||
207 | |||
214 | /* turn the display upside down */ | 208 | /* turn the display upside down */ |
215 | void lcd_set_flip(bool yesno) | 209 | void lcd_set_flip(bool yesno) |
216 | { | 210 | { |
@@ -230,11 +224,11 @@ static void lcd_window(int xmin, int ymin, int xmax, int ymax) | |||
230 | } | 224 | } |
231 | else | 225 | else |
232 | { | 226 | { |
233 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, | 227 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, |
234 | ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); | 228 | ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); |
235 | lcd_write_reg(R_VERT_RAM_ADDR_POS, | 229 | lcd_write_reg(R_VERT_RAM_ADDR_POS, |
236 | ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_HEIGHT-1 - ymax)); | 230 | ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_HEIGHT-1 - ymax)); |
237 | lcd_write_reg(R_RAM_ADDR_SET, | 231 | lcd_write_reg(R_RAM_ADDR_SET, |
238 | ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_WIDTH-1 - xmin)); | 232 | ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_WIDTH-1 - xmin)); |
239 | } | 233 | } |
240 | } | 234 | } |
@@ -339,26 +333,20 @@ static void _display_on(void) | |||
339 | 333 | ||
340 | lcd_write_reg(R_DISP_CONTROL1, 0x0033 | r_disp_control_rev); | 334 | lcd_write_reg(R_DISP_CONTROL1, 0x0033 | r_disp_control_rev); |
341 | 335 | ||
342 | display_on=true; /* must be done before calling lcd_update() */ | 336 | display_on = true; /* must be done before calling lcd_update() */ |
343 | lcd_update(); | 337 | lcd_update(); |
344 | } | 338 | } |
345 | 339 | ||
346 | /* LCD init */ | ||
347 | void lcd_init_device(void) | 340 | void lcd_init_device(void) |
348 | { | 341 | { |
349 | ams3525_dbop_init(); | 342 | as3525_dbop_init(); |
350 | |||
351 | /* Init GPIOs the same as the OF */ | ||
352 | 343 | ||
353 | GPIOA_DIR |= (1<<5); | 344 | GPIOA_DIR |= (1<<5); |
354 | GPIOA_PIN(5) = 0; | 345 | GPIOA_PIN(5) = 0; |
355 | 346 | GPIOA_PIN(4) = 0; | |
356 | GPIOA_PIN(4) = 0; /*c80b0040 := 0;*/ | ||
357 | 347 | ||
358 | lcd_delay(1); | 348 | lcd_delay(1); |
359 | |||
360 | GPIOA_PIN(5) = (1<<5); | 349 | GPIOA_PIN(5) = (1<<5); |
361 | |||
362 | lcd_delay(1); | 350 | lcd_delay(1); |
363 | 351 | ||
364 | _display_on(); | 352 | _display_on(); |
@@ -367,18 +355,18 @@ void lcd_init_device(void) | |||
367 | #if defined(HAVE_LCD_ENABLE) | 355 | #if defined(HAVE_LCD_ENABLE) |
368 | void lcd_enable(bool on) | 356 | void lcd_enable(bool on) |
369 | { | 357 | { |
370 | if(display_on!=on) | 358 | if (display_on == on) |
359 | return; | ||
360 | |||
361 | if(on) | ||
371 | { | 362 | { |
372 | if(on) | 363 | _display_on(); |
373 | { | 364 | send_event(LCD_EVENT_ACTIVATION, NULL); |
374 | _display_on(); | 365 | } |
375 | send_event(LCD_EVENT_ACTIVATION, NULL); | 366 | else |
376 | } | 367 | { |
377 | else | 368 | display_on = false; |
378 | { | 369 | lcd_write_reg(R_POWER_CONTROL1, 0x0001); |
379 | display_on=false; | ||
380 | lcd_write_reg(R_POWER_CONTROL1, 0x0001); | ||
381 | } | ||
382 | } | 370 | } |
383 | } | 371 | } |
384 | #endif | 372 | #endif |
@@ -388,23 +376,12 @@ bool lcd_active(void) | |||
388 | { | 376 | { |
389 | return display_on; | 377 | return display_on; |
390 | } | 378 | } |
391 | |||
392 | #endif | 379 | #endif |
393 | 380 | ||
394 | /*** update functions ***/ | 381 | /*** update functions ***/ |
395 | 382 | ||
396 | static unsigned lcd_yuv_options = 0; | 383 | static unsigned lcd_yuv_options = 0; |
397 | 384 | ||
398 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ | ||
399 | extern void lcd_write_yuv420_lines(unsigned char const * const src[3], | ||
400 | int width, | ||
401 | int stride); | ||
402 | extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3], | ||
403 | int width, | ||
404 | int stride, | ||
405 | int x_screen, /* To align dither pattern */ | ||
406 | int y_screen); | ||
407 | |||
408 | void lcd_yuv_set_options(unsigned options) | 385 | void lcd_yuv_set_options(unsigned options) |
409 | { | 386 | { |
410 | lcd_yuv_options = options; | 387 | lcd_yuv_options = options; |
@@ -414,13 +391,13 @@ static void lcd_window_blit(int xmin, int ymin, int xmax, int ymax) | |||
414 | { | 391 | { |
415 | if (!display_flipped) | 392 | if (!display_flipped) |
416 | { | 393 | { |
417 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, | 394 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, |
418 | ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); | 395 | ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); |
419 | lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); | 396 | lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); |
420 | lcd_write_reg(R_RAM_ADDR_SET, | 397 | lcd_write_reg(R_RAM_ADDR_SET, |
421 | (ymin << 8) | (LCD_WIDTH-1 - xmin)); | 398 | (ymin << 8) | (LCD_WIDTH-1 - xmin)); |
422 | } | 399 | } |
423 | else | 400 | else |
424 | { | 401 | { |
425 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin); | 402 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin); |
426 | lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); | 403 | lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); |
@@ -428,6 +405,16 @@ static void lcd_window_blit(int xmin, int ymin, int xmax, int ymax) | |||
428 | } | 405 | } |
429 | } | 406 | } |
430 | 407 | ||
408 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ | ||
409 | extern void lcd_write_yuv420_lines(unsigned char const * const src[3], | ||
410 | int width, | ||
411 | int stride); | ||
412 | extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3], | ||
413 | int width, | ||
414 | int stride, | ||
415 | int x_screen, /* To align dither pattern */ | ||
416 | int y_screen); | ||
417 | |||
431 | /* Performance function to blit a YUV bitmap directly to the LCD | 418 | /* Performance function to blit a YUV bitmap directly to the LCD |
432 | * src_x, src_y, width and height should be even | 419 | * src_x, src_y, width and height should be even |
433 | * x, y, width and height have to be within LCD bounds | 420 | * x, y, width and height have to be within LCD bounds |
@@ -439,8 +426,6 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
439 | unsigned char const * yuv_src[3]; | 426 | unsigned char const * yuv_src[3]; |
440 | off_t z; | 427 | off_t z; |
441 | 428 | ||
442 | lcd_busy = true; | ||
443 | |||
444 | /* Sorry, but width and height must be >= 2 or else */ | 429 | /* Sorry, but width and height must be >= 2 or else */ |
445 | width &= ~1; | 430 | width &= ~1; |
446 | height >>= 1; | 431 | height >>= 1; |
@@ -450,14 +435,11 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
450 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); | 435 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); |
451 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); | 436 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); |
452 | 437 | ||
453 | if (!display_flipped) | 438 | lcd_busy = true; |
454 | { | 439 | |
455 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VIDEO_NORMAL); | 440 | lcd_write_reg(R_ENTRY_MODE, |
456 | } | 441 | display_flipped ? R_ENTRY_MODE_VIDEO_FLIPPED : R_ENTRY_MODE_VIDEO_NORMAL |
457 | else | 442 | ); |
458 | { | ||
459 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VIDEO_FLIPPED); | ||
460 | } | ||
461 | 443 | ||
462 | if (lcd_yuv_options & LCD_YUV_DITHER) | 444 | if (lcd_yuv_options & LCD_YUV_DITHER) |
463 | { | 445 | { |
@@ -465,14 +447,13 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
465 | { | 447 | { |
466 | lcd_window_blit(y, x, y+1, x+width-1); | 448 | lcd_window_blit(y, x, y+1, x+width-1); |
467 | 449 | ||
468 | /* Start write to GRAM */ | ||
469 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); | 450 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); |
470 | 451 | ||
471 | lcd_write_yuv420_lines_odither(yuv_src, width, stride, x, y); | 452 | lcd_write_yuv420_lines_odither(yuv_src, width, stride, x, y); |
472 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ | 453 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ |
473 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | 454 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ |
474 | yuv_src[2] += stride >> 1; | 455 | yuv_src[2] += stride >> 1; |
475 | y+=2; | 456 | y += 2; |
476 | } | 457 | } |
477 | while (--height > 0); | 458 | while (--height > 0); |
478 | } | 459 | } |
@@ -482,14 +463,13 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
482 | { | 463 | { |
483 | lcd_window_blit(y, x, y+1, x+width-1); | 464 | lcd_window_blit(y, x, y+1, x+width-1); |
484 | 465 | ||
485 | /* Start write to GRAM */ | ||
486 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); | 466 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); |
487 | 467 | ||
488 | lcd_write_yuv420_lines(yuv_src, width, stride); | 468 | lcd_write_yuv420_lines(yuv_src, width, stride); |
489 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ | 469 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ |
490 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | 470 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ |
491 | yuv_src[2] += stride >> 1; | 471 | yuv_src[2] += stride >> 1; |
492 | y+=2; | 472 | y += 2; |
493 | } | 473 | } |
494 | while (--height > 0); | 474 | while (--height > 0); |
495 | } | 475 | } |
@@ -516,15 +496,13 @@ void lcd_update(void) | |||
516 | lcd_write_data((fb_data*)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); | 496 | lcd_write_data((fb_data*)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); |
517 | 497 | ||
518 | lcd_busy = false; | 498 | lcd_busy = false; |
519 | } /* lcd_update */ | 499 | } |
520 | |||
521 | 500 | ||
522 | /* Update a fraction of the display. */ | 501 | /* Update a fraction of the display. */ |
523 | void lcd_update_rect(int x, int y, int width, int height) | 502 | void lcd_update_rect(int x, int y, int width, int height) |
524 | { | 503 | { |
525 | const fb_data *ptr; | 504 | const fb_data *ptr; |
526 | int ymax, xmax; | 505 | int xmax, ymax; |
527 | |||
528 | 506 | ||
529 | if (!display_on) | 507 | if (!display_on) |
530 | return; | 508 | return; |
@@ -550,15 +528,13 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
550 | lcd_busy = true; | 528 | lcd_busy = true; |
551 | 529 | ||
552 | lcd_write_reg(R_ENTRY_MODE, r_entry_mode); | 530 | lcd_write_reg(R_ENTRY_MODE, r_entry_mode); |
553 | 531 | ||
554 | lcd_window(x, y, xmax, ymax); | 532 | lcd_window(x, y, xmax, ymax); |
555 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); | 533 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); |
556 | 534 | ||
557 | ptr = (fb_data*)&lcd_framebuffer[y][x]; | 535 | ptr = &lcd_framebuffer[y][x]; |
558 | 536 | ||
559 | |||
560 | height = ymax - y; /* fix height */ | 537 | height = ymax - y; /* fix height */ |
561 | |||
562 | do | 538 | do |
563 | { | 539 | { |
564 | lcd_write_data(ptr, width); | 540 | lcd_write_data(ptr, width); |
@@ -567,23 +543,23 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
567 | while (--height >= 0); | 543 | while (--height >= 0); |
568 | 544 | ||
569 | lcd_busy = false; | 545 | lcd_busy = false; |
570 | } /* lcd_update_rect */ | 546 | } |
571 | 547 | ||
572 | /* writes one red pixel outside the visible area, needed for correct | 548 | /* writes one red pixel outside the visible area, needed for correct |
573 | * dbop reads */ | 549 | * dbop reads */ |
574 | bool lcd_button_support(void) | 550 | bool lcd_button_support(void) |
575 | { | 551 | { |
576 | fb_data data = (0xf<<12); | ||
577 | |||
578 | if (lcd_busy) | 552 | if (lcd_busy) |
579 | return false; | 553 | return false; |
580 | 554 | ||
581 | lcd_write_reg(R_ENTRY_MODE, r_entry_mode); | 555 | lcd_write_reg(R_ENTRY_MODE, r_entry_mode); |
556 | |||
582 | /* Set start position and window */ | 557 | /* Set start position and window */ |
583 | lcd_window(LCD_WIDTH+1, LCD_HEIGHT+1, LCD_WIDTH+2, LCD_HEIGHT+2); | 558 | lcd_window(LCD_WIDTH+1, LCD_HEIGHT+1, LCD_WIDTH+2, LCD_HEIGHT+2); |
584 | 559 | ||
585 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); | 560 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); |
586 | 561 | ||
587 | lcd_write_single_data16(data); | 562 | lcd_write_value16(0xf<<12); |
563 | |||
588 | return true; | 564 | return true; |
589 | } | 565 | } |