summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2003-07-09 23:07:49 +0000
committerBjörn Stenberg <bjorn@haxx.se>2003-07-09 23:07:49 +0000
commit067262dbf09d63fb645d1c2e67d225325b6854c9 (patch)
treeb971492d0c80a496e596226a952ffe222f2c468b /firmware/drivers
parent0ef911d43c364fe535111c59abab54e10dc06ce1 (diff)
downloadrockbox-067262dbf09d63fb645d1c2e67d225325b6854c9.tar.gz
rockbox-067262dbf09d63fb645d1c2e67d225325b6854c9.zip
Moved lcd default contrast knowledge from settings.c to lcd driver. Now lcd_init sets default contrast until settings are read.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3824 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/lcd-player.c7
-rw-r--r--firmware/drivers/lcd-recorder.c41
2 files changed, 31 insertions, 17 deletions
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c
index 6f58f8ec1a..bbb157a94f 100644
--- a/firmware/drivers/lcd-player.c
+++ b/firmware/drivers/lcd-player.c
@@ -278,6 +278,11 @@ bool lcdx_putc(int x, int y, unsigned short ch)
278 return false; 278 return false;
279} 279}
280 280
281int lcd_default_contrast(void)
282{
283 return 30;
284}
285
281void lcd_clear_display(void) 286void lcd_clear_display(void)
282{ 287{
283 int i; 288 int i;
@@ -497,6 +502,8 @@ void lcd_init (void)
497 pattern_size=3; /* Last pattern, 3 for old LCD, 7 for new LCD */ 502 pattern_size=3; /* Last pattern, 3 for old LCD, 7 for new LCD */
498 } 503 }
499 504
505 lcd_set_contrast(lcd_default_contrast());
506
500 create_thread(scroll_thread, scroll_stack, 507 create_thread(scroll_thread, scroll_stack,
501 sizeof(scroll_stack), scroll_name); 508 sizeof(scroll_stack), scroll_name);
502} 509}
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c
index 00b4ed78b2..597c7d246a 100644
--- a/firmware/drivers/lcd-recorder.c
+++ b/firmware/drivers/lcd-recorder.c
@@ -29,6 +29,7 @@
29#include "debug.h" 29#include "debug.h"
30#include "system.h" 30#include "system.h"
31#include "font.h" 31#include "font.h"
32#include "hwcompat.h"
32 33
33/*** definitions ***/ 34/*** definitions ***/
34 35
@@ -113,6 +114,15 @@ static unsigned char zeros[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
113static unsigned char ones[8] = { 0xff, 0xff, 0xff, 0xff, 114static unsigned char ones[8] = { 0xff, 0xff, 0xff, 0xff,
114 0xff, 0xff, 0xff, 0xff}; 115 0xff, 0xff, 0xff, 0xff};
115 116
117int lcd_default_contrast(void)
118{
119#ifdef SIMULATOR
120 return 30;
121#else
122 return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49;
123#endif
124}
125
116#ifdef SIMULATOR 126#ifdef SIMULATOR
117 127
118void lcd_init(void) 128void lcd_init(void)
@@ -132,23 +142,20 @@ void lcd_init (void)
132 PBCR2 &= 0xff00; /* MD = 00 */ 142 PBCR2 &= 0xff00; /* MD = 00 */
133 PBIOR |= 0x000f; /* IOR = 1 */ 143 PBIOR |= 0x000f; /* IOR = 1 */
134 144
135 /* inits like the original firmware */ 145 /* inits like the original firmware */
136 lcd_write(true, LCD_SOFTWARE_RESET); 146 lcd_write(true, LCD_SOFTWARE_RESET);
137 lcd_write(true, LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO + 4); 147 lcd_write(true, LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO + 4);
138 lcd_write(true, LCD_SET_1OVER4_BIAS_RATIO + 0); /* force 1/4 bias: 0 */ 148 lcd_write(true, LCD_SET_1OVER4_BIAS_RATIO + 0); /* force 1/4 bias: 0 */
139 lcd_write(true, LCD_SET_POWER_CONTROL_REGISTER + 7); /* power control register: op-amp=1, regulator=1, booster=1 */ 149 lcd_write(true, LCD_SET_POWER_CONTROL_REGISTER + 7); /* power control register: op-amp=1, regulator=1, booster=1 */
140 lcd_write(true, LCD_SET_DISPLAY_ON); 150 lcd_write(true, LCD_SET_DISPLAY_ON);
141 lcd_write(true, LCD_SET_NORMAL_DISPLAY); 151 lcd_write(true, LCD_SET_NORMAL_DISPLAY);
142 lcd_write(true, LCD_SET_SEGMENT_REMAP + 1); /* mirror horizontal: 1 */ 152 lcd_write(true, LCD_SET_SEGMENT_REMAP + 1); /* mirror horizontal: 1 */
143 lcd_write(true, LCD_SET_COM_OUTPUT_SCAN_DIRECTION + 8); /* mirror vertical: 1 */ 153 lcd_write(true, LCD_SET_COM_OUTPUT_SCAN_DIRECTION + 8); /* mirror vertical: 1 */
144 lcd_write(true, LCD_SET_DISPLAY_START_LINE + 0); 154 lcd_write(true, LCD_SET_DISPLAY_START_LINE + 0);
145#if 0 /* done later, depending on h/w mask bit and settings */ 155 lcd_set_contrast(lcd_default_contrast());
146 lcd_write(true, LCD_SET_CONTRAST_CONTROL_REGISTER); 156 lcd_write(true, LCD_SET_PAGE_ADDRESS);
147 lcd_write(true, 0xF1); /* contrast set to 49/64 */ 157 lcd_write(true, LCD_SET_LOWER_COLUMN_ADDRESS + 0);
148#endif 158 lcd_write(true, LCD_SET_HIGHER_COLUMN_ADDRESS + 0);
149 lcd_write(true, LCD_SET_PAGE_ADDRESS);
150 lcd_write(true, LCD_SET_LOWER_COLUMN_ADDRESS + 0);
151 lcd_write(true, LCD_SET_HIGHER_COLUMN_ADDRESS + 0);
152 159
153 lcd_clear_display(); 160 lcd_clear_display();
154 lcd_update(); 161 lcd_update();