diff options
author | Dave Chapman <dave@dchapman.com> | 2009-07-16 18:03:09 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2009-07-16 18:03:09 +0000 |
commit | 715d8c63d9a051b2ab7ab6ac27639d090a1823f1 (patch) | |
tree | 4ea5cfb387d17dc0745b7fca413ca027e1db07e1 /firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | |
parent | f8ec7e4ad457a7a3a428f18eaf35f50a28d752b4 (diff) | |
download | rockbox-715d8c63d9a051b2ab7ab6ac27639d090a1823f1.tar.gz rockbox-715d8c63d9a051b2ab7ab6ac27639d090a1823f1.zip |
Add auto-detection of Nano 2G LCD type, and an initial attempt at lcd_update() for the second lcd type. This lcd_update works, but not reliably.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21905 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c')
-rw-r--r-- | firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | 95 |
1 files changed, 66 insertions, 29 deletions
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c index 74f2fca383..ad2e356b5e 100644 --- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c +++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | |||
@@ -40,9 +40,9 @@ static void s5l_lcd_write_data(int data) | |||
40 | while (LCD_STATUS&0x10); | 40 | while (LCD_STATUS&0x10); |
41 | } | 41 | } |
42 | 42 | ||
43 | |||
44 | /** globals **/ | 43 | /** globals **/ |
45 | 44 | ||
45 | static int lcd_type; | ||
46 | static int xoffset; /* needed for flip */ | 46 | static int xoffset; /* needed for flip */ |
47 | 47 | ||
48 | /*** hardware configuration ***/ | 48 | /*** hardware configuration ***/ |
@@ -89,6 +89,15 @@ void lcd_on(void) | |||
89 | /* LCD init */ | 89 | /* LCD init */ |
90 | void lcd_init_device(void) | 90 | void lcd_init_device(void) |
91 | { | 91 | { |
92 | /* Detect lcd type */ | ||
93 | |||
94 | PCON13 &= ~0xf; /* Set pin 0 to input */ | ||
95 | PCON14 &= ~0xf0; /* Set pin 1 to input */ | ||
96 | |||
97 | if (((PDAT13 & 1) == 0) && ((PDAT14 & 2) == 2)) | ||
98 | lcd_type = 0; | ||
99 | else | ||
100 | lcd_type = 1; | ||
92 | } | 101 | } |
93 | 102 | ||
94 | 103 | ||
@@ -127,36 +136,64 @@ void lcd_update(void) ICODE_ATTR; | |||
127 | void lcd_update(void) | 136 | void lcd_update(void) |
128 | { | 137 | { |
129 | int x,y; | 138 | int x,y; |
130 | fb_data* p; | 139 | fb_data* p = &lcd_framebuffer[0][0]; |
131 | fb_data pixel; | 140 | fb_data pixel; |
132 | 141 | ||
133 | s5l_lcd_write_cmd(0x3a); | 142 | if (lcd_type==0) { |
134 | s5l_lcd_write_data(0x65); | 143 | s5l_lcd_write_cmd(0x50); |
135 | 144 | s5l_lcd_write_data(0); /* Start column */ | |
136 | s5l_lcd_write_cmd(0x2a); | 145 | s5l_lcd_write_cmd(0x51); |
137 | s5l_lcd_write_data(0); | 146 | s5l_lcd_write_data(LCD_WIDTH-1); /* End column */ |
138 | s5l_lcd_write_data(0); | 147 | s5l_lcd_write_cmd(0x52); |
139 | s5l_lcd_write_data(0); | 148 | s5l_lcd_write_data(0); /* Start row */ |
140 | s5l_lcd_write_data(LCD_WIDTH-1); | 149 | s5l_lcd_write_cmd(0x53); |
141 | 150 | s5l_lcd_write_data(LCD_HEIGHT-1); /* End row */ | |
142 | s5l_lcd_write_cmd(0x2b); | 151 | |
143 | s5l_lcd_write_data(0); | 152 | s5l_lcd_write_cmd(0x20); |
144 | s5l_lcd_write_data(0); | 153 | s5l_lcd_write_data(0); |
145 | s5l_lcd_write_data(0); | 154 | s5l_lcd_write_cmd(0x21); |
146 | s5l_lcd_write_data(LCD_HEIGHT-1); | 155 | s5l_lcd_write_data(0); |
147 | 156 | s5l_lcd_write_cmd(0x22); | |
148 | s5l_lcd_write_cmd(0x2c); | 157 | |
149 | 158 | /* Copy display bitmap to hardware */ | |
150 | /* Copy display bitmap to hardware */ | 159 | for (y = 0; y < LCD_HEIGHT; y++) { |
151 | 160 | for (x = 0; x < LCD_WIDTH; x++) { | |
152 | p = &lcd_framebuffer[0][0]; | 161 | pixel = *(p++); |
153 | for (y = 0; y < LCD_HEIGHT; y++) { | 162 | |
154 | for (x = 0; x < LCD_WIDTH; x++) { | 163 | while (LCD_STATUS&0x10); |
155 | pixel = *(p++); | 164 | |
156 | 165 | LCD_WDATA = pixel & 0xff; | |
157 | while (LCD_STATUS&0x10); | 166 | LCD_WDATA = (pixel & 0xff00) >> 8; |
158 | LCD_WDATA = (pixel & 0xff00) >> 8; | 167 | } |
159 | LCD_WDATA = pixel & 0xff; | 168 | } |
169 | } else { | ||
170 | s5l_lcd_write_cmd(0x3a); | ||
171 | s5l_lcd_write_data(0x65); | ||
172 | |||
173 | s5l_lcd_write_cmd(0x2a); | ||
174 | s5l_lcd_write_data(0); /* Start column, high byte */ | ||
175 | s5l_lcd_write_data(0); /* Start column. low byte */ | ||
176 | s5l_lcd_write_data(0); /* End column, high byte */ | ||
177 | s5l_lcd_write_data(LCD_WIDTH-1); /* End column, low byte */ | ||
178 | |||
179 | s5l_lcd_write_cmd(0x2b); | ||
180 | s5l_lcd_write_data(0); /* Start row, high byte */ | ||
181 | s5l_lcd_write_data(0); /* Start row, low byte */ | ||
182 | s5l_lcd_write_data(0); /* End row, high byte */ | ||
183 | s5l_lcd_write_data(LCD_HEIGHT-1); /* End row, low byte */ | ||
184 | |||
185 | s5l_lcd_write_cmd(0x2c); | ||
186 | |||
187 | /* Copy display bitmap to hardware */ | ||
188 | for (y = 0; y < LCD_HEIGHT; y++) { | ||
189 | for (x = 0; x < LCD_WIDTH; x++) { | ||
190 | pixel = *(p++); | ||
191 | |||
192 | while (LCD_STATUS&0x10); | ||
193 | |||
194 | LCD_WDATA = (pixel & 0xff00) >> 8; | ||
195 | LCD_WDATA = pixel & 0xff; | ||
196 | } | ||
160 | } | 197 | } |
161 | } | 198 | } |
162 | 199 | ||