From be84fcffbd4bcc6e009a2a223b269b61098fdb93 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 17 Feb 2009 02:36:48 +0000 Subject: Some Sansa Fuze work: Get Home button working (no keymap changes yet, so it's not very noticeable) and "fix" debug menu from not showing the dbop data (see FIXME), some cleanup in the fuze's button driver git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20027 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c | 27 ++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c') diff --git a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c index b8feeb103e..f9de3c3117 100644 --- a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c +++ b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c @@ -42,6 +42,8 @@ static bool display_on = false; /* is the display turned on? */ static bool display_flipped = false; static int xoffset = 20; /* needed for flip */ +static volatile int _ystart, _ymax, _xstart, _xmax; + static void as3525_dbop_init(void) { CGU_DBOP = (1<<3) | CLK_DIV(AS3525_PCLK_FREQ, AS3525_DBOP_FREQ); @@ -258,22 +260,20 @@ void lcd_init_device() } /* Set horizontal window addresses */ -static void lcd_window_x(int xmin, int xmax) +void lcd_window_x(int xmin, int xmax) { xmin += xoffset; xmax += xoffset; - lcd_write_reg(0x46, (xmax << 8) | xmin); lcd_write_reg(0x20, xmin); } /* Set vertical window addresses */ -static void lcd_window_y(int ymin, int ymax) +void lcd_window_y(int ymin, int ymax) { lcd_write_reg(0x47, ymax); lcd_write_reg(0x48, ymin); lcd_write_reg(0x21, ymin); - lcd_write_cmd(0x22); } /* Update the display. @@ -285,6 +285,8 @@ void lcd_update(void) lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); + /* we must disable interrupts because buttondriver also writes to lcd */ + disable_irq(); lcd_window_x(0, LCD_WIDTH - 1); lcd_window_y(0, LCD_HEIGHT - 1); @@ -293,6 +295,7 @@ void lcd_update(void) /* Write data */ lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); + enable_irq(); } /* Update a fraction of the display. */ @@ -324,6 +327,8 @@ void lcd_update_rect(int x, int y, int width, int height) lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); + /* we must disable interrupts because buttondriver also writes to lcd */ + disable_irq(); lcd_window_x(x, xmax); lcd_window_y(y, ymax); @@ -338,4 +343,18 @@ void lcd_update_rect(int x, int y, int width, int height) ptr += LCD_WIDTH; } while (++y <= ymax); + enable_irq(); +} + +/* writes one read pixel outside the visible area, needed for correct dbop reads */ +void lcd_button_support(void) +{ + fb_data data = 0xf<<12; + lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); + /* Set start position and window */ + + lcd_window_x(-1, 1); + lcd_write_cmd(R_WRITE_DATA_2_GRAM); + + lcd_write_data(&data, 1); } -- cgit v1.2.3