diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-06-17 21:43:00 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-06-17 21:43:00 +0000 |
commit | bd1bb5f009ca81737882335c6037a17b8e2788b0 (patch) | |
tree | aac81c5dfafa2a33131e3bf52aba0361b8b50390 | |
parent | ba7dccf15ac7fb03758f03d1bc0e8654c2fe7792 (diff) | |
download | rockbox-bd1bb5f009ca81737882335c6037a17b8e2788b0.tar.gz rockbox-bd1bb5f009ca81737882335c6037a17b8e2788b0.zip |
iriver: LCD flip for H1x0 remote, some code cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6739 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/settings.c | 10 | ||||
-rw-r--r-- | apps/settings_menu.c | 15 | ||||
-rw-r--r-- | firmware/drivers/lcd-h100-remote.c | 46 | ||||
-rw-r--r-- | firmware/export/lcd-remote.h | 2 |
4 files changed, 60 insertions, 13 deletions
diff --git a/apps/settings.c b/apps/settings.c index ea664a13ed..6588a6efd5 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -264,6 +264,7 @@ static const struct bit_entry rtc_bits[] = | |||
264 | {1, S_O(remote_invert), false, "remote invert", off_on }, | 264 | {1, S_O(remote_invert), false, "remote invert", off_on }, |
265 | {5, S_O(remote_backlight_timeout), 5, "remote backlight timeout", | 265 | {5, S_O(remote_backlight_timeout), 5, "remote backlight timeout", |
266 | "off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90" }, | 266 | "off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90" }, |
267 | {1, S_O(remote_flip_display), false, "remote flip display", off_on }, | ||
267 | #endif | 268 | #endif |
268 | 269 | ||
269 | /* Current sum of bits: 259 (worst case) */ | 270 | /* Current sum of bits: 259 (worst case) */ |
@@ -394,7 +395,7 @@ static const struct bit_entry hd_bits[] = | |||
394 | #endif | 395 | #endif |
395 | 396 | ||
396 | /* new stuff to be added at the end */ | 397 | /* new stuff to be added at the end */ |
397 | 398 | ||
398 | /* Sum of all bit sizes must not grow beyond 0xB8*8 = 1472 */ | 399 | /* Sum of all bit sizes must not grow beyond 0xB8*8 = 1472 */ |
399 | }; | 400 | }; |
400 | 401 | ||
@@ -757,10 +758,11 @@ void settings_apply(void) | |||
757 | lcd_set_contrast(global_settings.contrast); | 758 | lcd_set_contrast(global_settings.contrast); |
758 | lcd_scroll_speed(global_settings.scroll_speed); | 759 | lcd_scroll_speed(global_settings.scroll_speed); |
759 | #ifdef HAVE_REMOTE_LCD | 760 | #ifdef HAVE_REMOTE_LCD |
760 | lcd_remote_set_contrast(global_settings.remote_contrast); | 761 | lcd_remote_set_contrast(global_settings.remote_contrast); |
761 | lcd_remote_set_invert_display(global_settings.remote_invert); | 762 | lcd_remote_set_invert_display(global_settings.remote_invert); |
763 | lcd_remote_set_flip(global_settings.remote_flip_display); | ||
762 | remote_backlight_set_timeout(global_settings.remote_backlight_timeout); | 764 | remote_backlight_set_timeout(global_settings.remote_backlight_timeout); |
763 | #endif | 765 | #endif |
764 | backlight_set_timeout(global_settings.backlight_timeout); | 766 | backlight_set_timeout(global_settings.backlight_timeout); |
765 | backlight_set_on_when_charging(global_settings.backlight_on_when_charging); | 767 | backlight_set_on_when_charging(global_settings.backlight_on_when_charging); |
766 | ata_spindown(global_settings.disk_spindown); | 768 | ata_spindown(global_settings.disk_spindown); |
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 9826058202..d8f440c25c 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -101,6 +101,17 @@ static bool remote_invert(void) | |||
101 | lcd_remote_set_invert_display); | 101 | lcd_remote_set_invert_display); |
102 | return rc; | 102 | return rc; |
103 | } | 103 | } |
104 | |||
105 | static bool remote_flip_display(void) | ||
106 | { | ||
107 | bool rc = set_bool( str(LANG_FLIP_DISPLAY), | ||
108 | &global_settings.remote_flip_display); | ||
109 | |||
110 | lcd_remote_set_flip(global_settings.remote_flip_display); | ||
111 | lcd_remote_update(); | ||
112 | |||
113 | return rc; | ||
114 | } | ||
104 | #endif | 115 | #endif |
105 | 116 | ||
106 | #ifdef CONFIG_BACKLIGHT | 117 | #ifdef CONFIG_BACKLIGHT |
@@ -1262,8 +1273,8 @@ static bool lcd_remote_settings_menu(void) | |||
1262 | { ID2P(LANG_BACKLIGHT), remote_backlight_timer }, | 1273 | { ID2P(LANG_BACKLIGHT), remote_backlight_timer }, |
1263 | { ID2P(LANG_CONTRAST), remote_contrast }, | 1274 | { ID2P(LANG_CONTRAST), remote_contrast }, |
1264 | { ID2P(LANG_INVERT), remote_invert }, | 1275 | { ID2P(LANG_INVERT), remote_invert }, |
1265 | /* { ID2P(LANG_FLIP_DISPLAY), remote_flip_display }, | 1276 | { ID2P(LANG_FLIP_DISPLAY), remote_flip_display }, |
1266 | { ID2P(LANG_INVERT_CURSOR), invert_cursor },*/ | 1277 | /* { ID2P(LANG_INVERT_CURSOR), invert_cursor },*/ |
1267 | }; | 1278 | }; |
1268 | 1279 | ||
1269 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 1280 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c index 2850712a91..04a4b7f7a0 100644 --- a/firmware/drivers/lcd-h100-remote.c +++ b/firmware/drivers/lcd-h100-remote.c | |||
@@ -38,6 +38,9 @@ static const unsigned char ones[8] = { | |||
38 | static int curfont = FONT_SYSFIXED; | 38 | static int curfont = FONT_SYSFIXED; |
39 | static int xmargin = 0; | 39 | static int xmargin = 0; |
40 | static int ymargin = 0; | 40 | static int ymargin = 0; |
41 | #ifndef SIMULATOR | ||
42 | static int xoffset; /* needed for flip */ | ||
43 | #endif | ||
41 | 44 | ||
42 | unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH] | 45 | unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH] |
43 | #ifndef SIMULATOR | 46 | #ifndef SIMULATOR |
@@ -70,6 +73,7 @@ static bool remote_initialized = false; | |||
70 | 73 | ||
71 | /* cached settings values, for hotplug init */ | 74 | /* cached settings values, for hotplug init */ |
72 | static bool cached_invert = false; | 75 | static bool cached_invert = false; |
76 | static bool cached_flip = false; | ||
73 | static int cached_contrast = 32; | 77 | static int cached_contrast = 32; |
74 | static int cached_roll = 0; | 78 | static int cached_roll = 0; |
75 | 79 | ||
@@ -206,7 +210,7 @@ void lcd_remote_write_command_ex(int cmd, int data) | |||
206 | #define LCD_REMOTE_CNTL_DISPLAY_ON_OFF 0xae | 210 | #define LCD_REMOTE_CNTL_DISPLAY_ON_OFF 0xae |
207 | #define LCD_REMOTE_CNTL_ENTIRE_ON_OFF 0xa4 | 211 | #define LCD_REMOTE_CNTL_ENTIRE_ON_OFF 0xa4 |
208 | #define LCD_REMOTE_CNTL_REVERSE_ON_OFF 0xa6 | 212 | #define LCD_REMOTE_CNTL_REVERSE_ON_OFF 0xa6 |
209 | #define LCD_REMOTE_CTNL_NOP 0xe3 | 213 | #define LCD_REMOTE_CNTL_NOP 0xe3 |
210 | #define LCD_REMOTE_CNTL_POWER_CONTROL 0x2b | 214 | #define LCD_REMOTE_CNTL_POWER_CONTROL 0x2b |
211 | #define LCD_REMOTE_CNTL_SELECT_REGULATOR 0x20 | 215 | #define LCD_REMOTE_CNTL_SELECT_REGULATOR 0x20 |
212 | #define LCD_REMOTE_CNTL_SELECT_BIAS 0xa2 | 216 | #define LCD_REMOTE_CNTL_SELECT_BIAS 0xa2 |
@@ -214,6 +218,9 @@ void lcd_remote_write_command_ex(int cmd, int data) | |||
214 | #define LCD_REMOTE_CNTL_INIT_LINE 0x40 | 218 | #define LCD_REMOTE_CNTL_INIT_LINE 0x40 |
215 | #define LCD_REMOTE_CNTL_SET_PAGE_ADDRESS 0xB0 | 219 | #define LCD_REMOTE_CNTL_SET_PAGE_ADDRESS 0xB0 |
216 | 220 | ||
221 | #define LCD_REMOTE_CNTL_HIGHCOL 0x10 /* Upper column address */ | ||
222 | #define LCD_REMOTE_CNTL_LOWCOL 0x00 /* Lower column address */ | ||
223 | |||
217 | void lcd_remote_powersave(bool on) | 224 | void lcd_remote_powersave(bool on) |
218 | { | 225 | { |
219 | if (remote_initialized) | 226 | if (remote_initialized) |
@@ -237,6 +244,30 @@ void lcd_remote_set_invert_display(bool yesno) | |||
237 | lcd_remote_write_command(LCD_REMOTE_CNTL_REVERSE_ON_OFF | yesno); | 244 | lcd_remote_write_command(LCD_REMOTE_CNTL_REVERSE_ON_OFF | yesno); |
238 | } | 245 | } |
239 | 246 | ||
247 | /* turn the display upside down (call lcd_remote_update() afterwards) */ | ||
248 | void lcd_remote_set_flip(bool yesno) | ||
249 | { | ||
250 | cached_flip = yesno; | ||
251 | if (yesno) | ||
252 | { | ||
253 | xoffset = 0; | ||
254 | if (remote_initialized) | ||
255 | { | ||
256 | lcd_remote_write_command(LCD_REMOTE_CNTL_ADC_NORMAL); | ||
257 | lcd_remote_write_command(LCD_REMOTE_CNTL_SHL_NORMAL); | ||
258 | } | ||
259 | } | ||
260 | else | ||
261 | { | ||
262 | xoffset = 132 - LCD_REMOTE_WIDTH; | ||
263 | if (remote_initialized) | ||
264 | { | ||
265 | lcd_remote_write_command(LCD_REMOTE_CNTL_ADC_REVERSE); | ||
266 | lcd_remote_write_command(LCD_REMOTE_CNTL_SHL_REVERSE); | ||
267 | } | ||
268 | } | ||
269 | } | ||
270 | |||
240 | int lcd_remote_default_contrast(void) | 271 | int lcd_remote_default_contrast(void) |
241 | { | 272 | { |
242 | return 32; | 273 | return 32; |
@@ -394,8 +425,6 @@ void lcd_remote_clear_display(void) | |||
394 | 425 | ||
395 | static void remote_lcd_init(void) | 426 | static void remote_lcd_init(void) |
396 | { | 427 | { |
397 | lcd_remote_write_command(LCD_REMOTE_CNTL_ADC_REVERSE); | ||
398 | lcd_remote_write_command(LCD_REMOTE_CNTL_SHL_REVERSE); | ||
399 | lcd_remote_write_command(LCD_REMOTE_CNTL_SELECT_BIAS | 0x0); | 428 | lcd_remote_write_command(LCD_REMOTE_CNTL_SELECT_BIAS | 0x0); |
400 | 429 | ||
401 | lcd_remote_write_command(LCD_REMOTE_CNTL_POWER_CONTROL | 0x5); | 430 | lcd_remote_write_command(LCD_REMOTE_CNTL_POWER_CONTROL | 0x5); |
@@ -416,6 +445,7 @@ static void remote_lcd_init(void) | |||
416 | 445 | ||
417 | remote_initialized = true; | 446 | remote_initialized = true; |
418 | 447 | ||
448 | lcd_remote_set_flip(cached_flip); | ||
419 | lcd_remote_set_contrast(cached_contrast); | 449 | lcd_remote_set_contrast(cached_contrast); |
420 | lcd_remote_set_invert_display(cached_invert); | 450 | lcd_remote_set_invert_display(cached_invert); |
421 | lcd_remote_roll(cached_roll); | 451 | lcd_remote_roll(cached_roll); |
@@ -490,7 +520,8 @@ void lcd_remote_update (void) | |||
490 | for (y = 0; y < LCD_REMOTE_HEIGHT / 8; y++) | 520 | for (y = 0; y < LCD_REMOTE_HEIGHT / 8; y++) |
491 | { | 521 | { |
492 | lcd_remote_write_command(LCD_REMOTE_CNTL_SET_PAGE_ADDRESS | y); | 522 | lcd_remote_write_command(LCD_REMOTE_CNTL_SET_PAGE_ADDRESS | y); |
493 | lcd_remote_write_command_ex(0x10, 0x04); | 523 | lcd_remote_write_command(LCD_REMOTE_CNTL_HIGHCOL | ((xoffset>>4) & 0xf)); |
524 | lcd_remote_write_command(LCD_REMOTE_CNTL_LOWCOL | (xoffset & 0xf)); | ||
494 | lcd_remote_write_data(lcd_remote_framebuffer[y], LCD_REMOTE_WIDTH); | 525 | lcd_remote_write_data(lcd_remote_framebuffer[y], LCD_REMOTE_WIDTH); |
495 | } | 526 | } |
496 | } | 527 | } |
@@ -522,8 +553,11 @@ void lcd_remote_update_rect (int x_start, int y, | |||
522 | for (; y <= ymax; y++) | 553 | for (; y <= ymax; y++) |
523 | { | 554 | { |
524 | lcd_remote_write_command(LCD_REMOTE_CNTL_SET_PAGE_ADDRESS | y); | 555 | lcd_remote_write_command(LCD_REMOTE_CNTL_SET_PAGE_ADDRESS | y); |
525 | lcd_remote_write_command_ex(0x10, 0x00); | 556 | lcd_remote_write_command(LCD_REMOTE_CNTL_HIGHCOL |
526 | lcd_remote_write_data(&lcd_remote_framebuffer[y][x_start], width); | 557 | | (((x_start+xoffset)>>4) & 0xf)); |
558 | lcd_remote_write_command(LCD_REMOTE_CNTL_LOWCOL | ||
559 | | ((x_start+xoffset) & 0xf)); | ||
560 | lcd_remote_write_data(&lcd_remote_framebuffer[y][x_start], width); | ||
527 | } | 561 | } |
528 | } | 562 | } |
529 | 563 | ||
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h index f57a6ee4ba..88b185ca93 100644 --- a/firmware/export/lcd-remote.h +++ b/firmware/export/lcd-remote.h | |||
@@ -79,7 +79,7 @@ extern void lcd_remote_clearpixel(int x, int y); | |||
79 | extern void lcd_remote_invertpixel(int x, int y); | 79 | extern void lcd_remote_invertpixel(int x, int y); |
80 | extern void lcd_remote_roll(int pixels); | 80 | extern void lcd_remote_roll(int pixels); |
81 | extern void lcd_remote_set_invert_display(bool yesno); | 81 | extern void lcd_remote_set_invert_display(bool yesno); |
82 | //extern void lcd_set_flip(bool yesno); | 82 | extern void lcd_remote_set_flip(bool yesno); |
83 | extern void lcd_remote_bidir_scroll(int threshold); | 83 | extern void lcd_remote_bidir_scroll(int threshold); |
84 | extern void lcd_remote_scroll_step(int pixels); | 84 | extern void lcd_remote_scroll_step(int pixels); |
85 | extern void lcd_remote_setfont(int font); | 85 | extern void lcd_remote_setfont(int font); |