diff options
| author | Dave Chapman <dave@dchapman.com> | 2009-07-16 00:00:16 +0000 |
|---|---|---|
| committer | Dave Chapman <dave@dchapman.com> | 2009-07-16 00:00:16 +0000 |
| commit | 02f5a001fecf83d2ae16aa3231b28378442ebfd0 (patch) | |
| tree | 5993afebaf0a723b25486d39e9c14a184c5df543 | |
| parent | 989021ed3cca4a76a14062bb2b64109cf77027b6 (diff) | |
| download | rockbox-02f5a001fecf83d2ae16aa3231b28378442ebfd0.zip rockbox-02f5a001fecf83d2ae16aa3231b28378442ebfd0.tar.gz rockbox-02f5a001fecf83d2ae16aa3231b28378442ebfd0.tar.bz2 rockbox-02f5a001fecf83d2ae16aa3231b28378442ebfd0.tar.xz | |
Working LCD driver for half the Nano2Gs. It now appears that there are two types of LCD though.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21895 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | 74 |
1 files changed, 54 insertions, 20 deletions
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c index daf8869..74f2fca 100644 --- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c +++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * $Id$ * - * Copyright (C) 2009 by ???? + * Copyright (C) 2009 by Dave Chapman * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,6 +26,21 @@ #include "system.h" #include "cpu.h" +/** hardware access functions */ + +static void s5l_lcd_write_cmd(unsigned short cmd) +{ + while (LCD_STATUS&0x10); + LCD_WCMD = cmd; +} + +static void s5l_lcd_write_data(int data) +{ + LCD_WDATA = data; + while (LCD_STATUS&0x10); +} + + /** globals **/ static int xoffset; /* needed for flip */ @@ -105,38 +120,57 @@ void lcd_blit_grey_phase_blit(unsigned char *values, unsigned char *phases, (void)stride; } + /* Update the display. This must be called after all other LCD functions that change the display. */ void lcd_update(void) ICODE_ATTR; void lcd_update(void) { - int y; + int x,y; + fb_data* p; + fb_data pixel; + + s5l_lcd_write_cmd(0x3a); + s5l_lcd_write_data(0x65); + + s5l_lcd_write_cmd(0x2a); + s5l_lcd_write_data(0); + s5l_lcd_write_data(0); + s5l_lcd_write_data(0); + s5l_lcd_write_data(LCD_WIDTH-1); + + s5l_lcd_write_cmd(0x2b); + s5l_lcd_write_data(0); + s5l_lcd_write_data(0); + s5l_lcd_write_data(0); + s5l_lcd_write_data(LCD_HEIGHT-1); + + s5l_lcd_write_cmd(0x2c); /* Copy display bitmap to hardware */ - for (y = 0; y < LCD_FBHEIGHT; y++) - { + + p = &lcd_framebuffer[0][0]; + for (y = 0; y < LCD_HEIGHT; y++) { + for (x = 0; x < LCD_WIDTH; x++) { + pixel = *(p++); + + while (LCD_STATUS&0x10); + LCD_WDATA = (pixel & 0xff00) >> 8; + LCD_WDATA = pixel & 0xff; + } } + + s5l_lcd_write_cmd(0x29); } /* Update a fraction of the display. */ void lcd_update_rect(int, int, int, int) ICODE_ATTR; void lcd_update_rect(int x, int y, int width, int height) { - int ymax; - - /* The Y coordinates have to work on even 8 pixel rows */ - ymax = (y + height-1) >> 3; - y >>= 3; - - if(x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (width <= 0) - return; /* nothing left to do, 0 is harmful to lcd_write_data() */ - if(ymax >= LCD_FBHEIGHT) - ymax = LCD_FBHEIGHT-1; + (void)x; + (void)y; + (void)width; + (void)height; - /* Copy specified rectange bitmap to hardware */ - for (; y <= ymax; y++) - { - } + lcd_update(); } |