summaryrefslogtreecommitdiff
path: root/firmware/target/arm/philips/sa9200/lcd-sa9200.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/philips/sa9200/lcd-sa9200.c')
-rw-r--r--firmware/target/arm/philips/sa9200/lcd-sa9200.c47
1 files changed, 37 insertions, 10 deletions
diff --git a/firmware/target/arm/philips/sa9200/lcd-sa9200.c b/firmware/target/arm/philips/sa9200/lcd-sa9200.c
index 47fbfa3843..3db308ed09 100644
--- a/firmware/target/arm/philips/sa9200/lcd-sa9200.c
+++ b/firmware/target/arm/philips/sa9200/lcd-sa9200.c
@@ -84,6 +84,15 @@ static inline void lcd_wait_write(void)
84 while (LCD1_CONTROL & LCD1_BUSY_MASK); 84 while (LCD1_CONTROL & LCD1_BUSY_MASK);
85} 85}
86 86
87/* send LCD pixel */
88static inline void lcd_send_pixel(unsigned pixel)
89{
90 lcd_wait_write();
91 *(volatile uint8_t *)&LCD1_DATA = pixel >> 8;
92 lcd_wait_write();
93 *(volatile uint8_t *)&LCD1_DATA = pixel;
94}
95
87/* send LCD data */ 96/* send LCD data */
88static void lcd_send_data(unsigned data) 97static void lcd_send_data(unsigned data)
89{ 98{
@@ -129,11 +138,14 @@ void lcd_init_device(void)
129 udelay(30000); 138 udelay(30000);
130#endif 139#endif
131 140
141 /* Already on */
132 power_on = true; 142 power_on = true;
133 display_on = true; 143 display_on = true;
134 invert = false; 144
135 flip = false; 145 /* Reset the options */
136 contrast = DEFAULT_CONTRAST_SETTING; 146 lcd_set_invert_display(false);
147 lcd_set_flip(false);
148 lcd_set_contrast(DEFAULT_CONTRAST_SETTING);
137} 149}
138 150
139#ifdef HAVE_LCD_SLEEP 151#ifdef HAVE_LCD_SLEEP
@@ -493,7 +505,8 @@ void lcd_update(void)
493 505
494 do 506 do
495 { 507 {
496 lcd_send_data(*addr++); 508 lcd_send_pixel(*addr++);
509 lcd_send_pixel(*addr++);
497 } 510 }
498 while (addr < end); 511 while (addr < end);
499} 512}
@@ -527,11 +540,25 @@ void lcd_update_rect(int x, int y, int width, int height)
527 lcd_write_reg(R_RAM_ADDR_SET, (y << 8) | x); 540 lcd_write_reg(R_RAM_ADDR_SET, (y << 8) | x);
528 lcd_send_command(R_WRITE_DATA_2_GRAM); 541 lcd_send_command(R_WRITE_DATA_2_GRAM);
529 542
530 do { 543 do
531 int w = width; 544 {
532 do { 545 int w = width - 1;
533 lcd_send_data(*addr++); 546
534 } while (--w > 0); 547 if (w > 0)
548 {
549 do
550 {
551 lcd_send_pixel(*addr++);
552 lcd_send_pixel(*addr++);
553 w -= 2;
554 }
555 while (w > 0);
556 }
557
558 if (w == 0)
559 lcd_send_pixel(*addr++); /* odd width */
560
535 addr += LCD_WIDTH - width; 561 addr += LCD_WIDTH - width;
536 } while (--height > 0); 562 }
563 while (--height > 0);
537} 564}