diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-07-03 18:50:07 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-07-03 18:50:07 +0000 |
commit | 9a471e603ebe77a3aae4692d80ceb32da50c88eb (patch) | |
tree | f0ebfffd2460de1be4255080b361e64bdc901ddb /firmware/target/arm/as3525/lcd-ssd1303.c | |
parent | 12b89c11e31cab842af081e8fc238e47c2711653 (diff) | |
download | rockbox-9a471e603ebe77a3aae4692d80ceb32da50c88eb.tar.gz rockbox-9a471e603ebe77a3aae4692d80ceb32da50c88eb.zip |
Clip+ LCD: support devices with a different controller
The new controller framebuffer (different from what is in clipv1/clipv2 and some clip+) has 128 columns, the old has 132 columns and is centered on the screen.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27257 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/lcd-ssd1303.c')
-rw-r--r-- | firmware/target/arm/as3525/lcd-ssd1303.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/firmware/target/arm/as3525/lcd-ssd1303.c b/firmware/target/arm/as3525/lcd-ssd1303.c index 09f2638ff7..e0e0715311 100644 --- a/firmware/target/arm/as3525/lcd-ssd1303.c +++ b/firmware/target/arm/as3525/lcd-ssd1303.c | |||
@@ -68,6 +68,7 @@ | |||
68 | /** globals **/ | 68 | /** globals **/ |
69 | 69 | ||
70 | static bool display_on; /* used by lcd_enable */ | 70 | static bool display_on; /* used by lcd_enable */ |
71 | static int offset; /* column offset */ | ||
71 | 72 | ||
72 | /*** hardware configuration ***/ | 73 | /*** hardware configuration ***/ |
73 | 74 | ||
@@ -135,10 +136,8 @@ bool lcd_active(void) | |||
135 | void lcd_init_device(void) | 136 | void lcd_init_device(void) |
136 | { | 137 | { |
137 | int i; | 138 | int i; |
138 | #define LCD_FULLSCREEN (128+4) | ||
139 | fb_data p_bytes[LCD_FULLSCREEN]; /* framebuffer used to clear the screen */ | ||
140 | 139 | ||
141 | lcd_hw_init(); | 140 | lcd_hw_init(&offset); |
142 | 141 | ||
143 | /* Set display clock (divide ratio = 1) and oscillator frequency (1) */ | 142 | /* Set display clock (divide ratio = 1) and oscillator frequency (1) */ |
144 | lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ); | 143 | lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ); |
@@ -181,12 +180,12 @@ void lcd_init_device(void) | |||
181 | lcd_write_command (LCD_SET_HIGHER_COLUMN_ADDRESS /*| 0*/); | 180 | lcd_write_command (LCD_SET_HIGHER_COLUMN_ADDRESS /*| 0*/); |
182 | lcd_write_command (LCD_SET_LOWER_COLUMN_ADDRESS /*| 0*/); | 181 | lcd_write_command (LCD_SET_LOWER_COLUMN_ADDRESS /*| 0*/); |
183 | 182 | ||
183 | fb_data p_bytes[LCD_WIDTH + 2 * offset]; | ||
184 | memset(p_bytes, 0, sizeof(p_bytes)); /* fills with 0 : pixel off */ | 184 | memset(p_bytes, 0, sizeof(p_bytes)); /* fills with 0 : pixel off */ |
185 | |||
186 | for(i = 0; i < 8; i++) | 185 | for(i = 0; i < 8; i++) |
187 | { | 186 | { |
188 | lcd_write_command (LCD_SET_PAGE_ADDRESS | (i /*& 0xf*/)); | 187 | lcd_write_command (LCD_SET_PAGE_ADDRESS | (i /*& 0xf*/)); |
189 | lcd_write_data(p_bytes, LCD_FULLSCREEN /* overscan */); | 188 | lcd_write_data(p_bytes, LCD_WIDTH + 2 * offset); |
190 | } | 189 | } |
191 | 190 | ||
192 | lcd_enable(true); | 191 | lcd_enable(true); |
@@ -208,8 +207,8 @@ void lcd_blit_mono(const unsigned char *data, int x, int by, int width, | |||
208 | while (bheight--) | 207 | while (bheight--) |
209 | { | 208 | { |
210 | lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf)); | 209 | lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf)); |
211 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+2)>>4) & 0xf)); | 210 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+offset)>>4) & 0xf)); |
212 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+2) & 0xf)); | 211 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+offset) & 0xf)); |
213 | 212 | ||
214 | lcd_write_data(data, width); | 213 | lcd_write_data(data, width); |
215 | data += stride; | 214 | data += stride; |
@@ -234,8 +233,8 @@ void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, | |||
234 | while (bheight--) | 233 | while (bheight--) |
235 | { | 234 | { |
236 | lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf)); | 235 | lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf)); |
237 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+2)>>4) & 0xf)); | 236 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+offset)>>4) & 0xf)); |
238 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+2) & 0xf)); | 237 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+offset) & 0xf)); |
239 | 238 | ||
240 | lcd_grey_data(values, phases, width); | 239 | lcd_grey_data(values, phases, width); |
241 | 240 | ||
@@ -261,8 +260,8 @@ void lcd_update(void) | |||
261 | for (y = 0; y < LCD_FBHEIGHT; y++) | 260 | for (y = 0; y < LCD_FBHEIGHT; y++) |
262 | { | 261 | { |
263 | lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); | 262 | lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); |
264 | lcd_write_command (LCD_CNTL_HIGHCOL | ((2 >> 4) & 0xf)); | 263 | lcd_write_command (LCD_CNTL_HIGHCOL | ((offset >> 4) & 0xf)); |
265 | lcd_write_command (LCD_CNTL_LOWCOL | (2 & 0xf)); | 264 | lcd_write_command (LCD_CNTL_LOWCOL | (offset & 0xf)); |
266 | 265 | ||
267 | lcd_write_data (lcd_framebuffer[y], LCD_WIDTH); | 266 | lcd_write_data (lcd_framebuffer[y], LCD_WIDTH); |
268 | } | 267 | } |
@@ -292,8 +291,8 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
292 | for (; y <= ymax; y++) | 291 | for (; y <= ymax; y++) |
293 | { | 292 | { |
294 | lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); | 293 | lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); |
295 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+2) >> 4) & 0xf)); | 294 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+offset) >> 4) & 0xf)); |
296 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+2) & 0xf)); | 295 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+offset) & 0xf)); |
297 | 296 | ||
298 | lcd_write_data (&lcd_framebuffer[y][x], width); | 297 | lcd_write_data (&lcd_framebuffer[y][x], width); |
299 | } | 298 | } |