summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c')
-rw-r--r--firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
index f9de3c3117..7443426c25 100644
--- a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
+++ b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
@@ -41,8 +41,10 @@
41static bool display_on = false; /* is the display turned on? */ 41static bool display_on = false; /* is the display turned on? */
42static bool display_flipped = false; 42static bool display_flipped = false;
43static int xoffset = 20; /* needed for flip */ 43static int xoffset = 20; /* needed for flip */
44 44/* we need to write a red pixel for correct button reads
45static volatile int _ystart, _ymax, _xstart, _xmax; 45 * (see lcd_button_support()), but that must not happen while the lcd is updating
46 * so block lcd_button_support the during updates */
47static volatile bool lcd_busy = false;
46 48
47static void as3525_dbop_init(void) 49static void as3525_dbop_init(void)
48{ 50{
@@ -285,8 +287,7 @@ void lcd_update(void)
285 287
286 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); 288 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ);
287 289
288 /* we must disable interrupts because buttondriver also writes to lcd */ 290 lcd_busy = true;
289 disable_irq();
290 lcd_window_x(0, LCD_WIDTH - 1); 291 lcd_window_x(0, LCD_WIDTH - 1);
291 lcd_window_y(0, LCD_HEIGHT - 1); 292 lcd_window_y(0, LCD_HEIGHT - 1);
292 293
@@ -295,7 +296,7 @@ void lcd_update(void)
295 296
296 /* Write data */ 297 /* Write data */
297 lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); 298 lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT);
298 enable_irq(); 299 lcd_busy = false;
299} 300}
300 301
301/* Update a fraction of the display. */ 302/* Update a fraction of the display. */
@@ -327,8 +328,7 @@ void lcd_update_rect(int x, int y, int width, int height)
327 328
328 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); 329 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ);
329 330
330 /* we must disable interrupts because buttondriver also writes to lcd */ 331 lcd_busy = true;
331 disable_irq();
332 lcd_window_x(x, xmax); 332 lcd_window_x(x, xmax);
333 lcd_window_y(y, ymax); 333 lcd_window_y(y, ymax);
334 334
@@ -343,13 +343,15 @@ void lcd_update_rect(int x, int y, int width, int height)
343 ptr += LCD_WIDTH; 343 ptr += LCD_WIDTH;
344 } 344 }
345 while (++y <= ymax); 345 while (++y <= ymax);
346 enable_irq(); 346 lcd_busy = false;
347} 347}
348 348
349/* writes one read pixel outside the visible area, needed for correct dbop reads */ 349/* writes one read pixel outside the visible area, needed for correct dbop reads */
350void lcd_button_support(void) 350void lcd_button_support(void)
351{ 351{
352 fb_data data = 0xf<<12; 352 fb_data data = 0xf<<12;
353 if (lcd_busy)
354 return;
353 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); 355 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ);
354 /* Set start position and window */ 356 /* Set start position and window */
355 357