From 8e66491ffea4543dd2d96f1fc8dab7f822125302 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Wed, 19 Mar 2008 00:34:56 +0000 Subject: M3: Make remote LCD hotplug work, and make 'backlight on button hold' use the correct hold switch. * Kill a warning. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16711 a1c6a512-1295-4272-9138-f99709370657 --- firmware/backlight.c | 31 ++++++++++++++++++++------- firmware/export/config-iaudiom3.h | 3 +++ firmware/export/lcd.h | 6 ++++++ firmware/target/coldfire/iaudio/m3/power-m3.c | 3 ++- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/firmware/backlight.c b/firmware/backlight.c index 181ead71a1..0f66fbf574 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c @@ -30,10 +30,8 @@ #include "button.h" #include "timer.h" #include "backlight.h" +#include "lcd.h" -#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) -#include "lcd.h" /* for lcd_enable() and lcd_sleep() */ -#endif #ifdef HAVE_REMOTE_LCD #include "lcd-remote.h" #endif @@ -367,7 +365,13 @@ void backlight_set_fade_out(int value) static void backlight_update_state(void) { #ifdef HAS_BUTTON_HOLD - if (button_hold() && (backlight_on_button_hold != 0)) + if ((backlight_on_button_hold != 0) +#ifdef HAVE_REMOTE_LCD_AS_MAIN + && remote_button_hold() +#else + && button_hold() +#endif + ) backlight_timeout = (backlight_on_button_hold == 2) ? 0 : -1; /* always on or always off */ else @@ -375,9 +379,9 @@ static void backlight_update_state(void) #if CONFIG_CHARGING if (charger_inserted() #ifdef HAVE_USB_POWER - || usb_powered() + || usb_powered() #endif - ) + ) backlight_timeout = backlight_timeout_plugged; else #endif @@ -452,8 +456,9 @@ void backlight_thread(void) break; #endif -#if defined(HAVE_REMOTE_LCD) && !defined(SIMULATOR) +#ifndef SIMULATOR /* Here for now or else the aggressive init messes up scrolling */ +#ifdef HAVE_REMOTE_LCD case SYS_REMOTE_PLUGGED: lcd_remote_on(); lcd_remote_update(); @@ -462,7 +467,17 @@ void backlight_thread(void) case SYS_REMOTE_UNPLUGGED: lcd_remote_off(); break; -#endif /* defined(HAVE_REMOTE_LCD) && !defined(SIMULATOR) */ +#elif defined HAVE_REMOTE_LCD_AS_MAIN + case SYS_REMOTE_PLUGGED: + lcd_on(); + lcd_update(); + break; + + case SYS_REMOTE_UNPLUGGED: + lcd_off(); + break; +#endif /* HAVE_REMOTE_LCD/ HAVE_REMOTE_LCD_AS_MAIN */ +#endif /* !SIMULATOR */ #ifdef SIMULATOR /* This one here too for lack of a better place */ case SYS_SCREENDUMP: diff --git a/firmware/export/config-iaudiom3.h b/firmware/export/config-iaudiom3.h index 8e4b4976f9..67415b8d19 100644 --- a/firmware/export/config-iaudiom3.h +++ b/firmware/export/config-iaudiom3.h @@ -47,6 +47,9 @@ #define LCD_PIXELFORMAT VERTICAL_INTERLEAVED +/* define this if only the remote has an LCD */ +#define HAVE_REMOTE_LCD_AS_MAIN + #define CONFIG_KEYPAD IAUDIO_M3_PAD #define AB_REPEAT_ENABLE 1 diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 474500db5f..18a28d9569 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -331,6 +331,12 @@ static inline unsigned lcd_color_to_native(unsigned color) extern fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH]; /** Port-specific functions. Enable in port config file. **/ +#ifdef HAVE_REMOTE_LCD_AS_MAIN +void lcd_on(void); +void lcd_off(void); +void lcd_poweroff(void); +#endif + #ifdef HAVE_LCD_ENABLE /* Enable/disable the main display. */ extern void lcd_enable(bool on); diff --git a/firmware/target/coldfire/iaudio/m3/power-m3.c b/firmware/target/coldfire/iaudio/m3/power-m3.c index 475f64ec4a..04eb360194 100644 --- a/firmware/target/coldfire/iaudio/m3/power-m3.c +++ b/firmware/target/coldfire/iaudio/m3/power-m3.c @@ -21,8 +21,9 @@ #include "cpu.h" #include #include "kernel.h" -#include "system.h" +#include "lcd.h" #include "power.h" +#include "system.h" #ifndef SIMULATOR -- cgit v1.2.3