From 12a0ed3b8dd5d8996abf827115f526e21e838872 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 26 Jan 2009 23:21:49 +0000 Subject: Commit FS#9724, which reworks the preprocessor defines related to backlight fading to a CONFIG_BACKLIGHT_FADING style. The apps/ code will only see which setting is supposed to be used, specific backlight fading handling is kept in firmware, slightly reword the manual text about software fading too with regards to the Gigabeat S git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19860 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/backlight-sw-fading.h | 5 ---- firmware/export/backlight.h | 6 ++--- firmware/export/config-c200.h | 21 ++++++--------- firmware/export/config-c200v2.h | 6 ----- firmware/export/config-cowond2.h | 10 ++----- firmware/export/config-e200.h | 9 +++---- firmware/export/config-e200v2.h | 21 ++++++--------- firmware/export/config-fuze.h | 21 ++++++--------- firmware/export/config-gigabeat-s.h | 5 ++-- firmware/export/config-h100.h | 2 +- firmware/export/config-h120.h | 2 +- firmware/export/config-h300.h | 8 ++---- firmware/export/config-iaudiox5.h | 8 ++---- firmware/export/config-ipodmini.h | 2 +- firmware/export/config-ipodmini2g.h | 2 +- firmware/export/config-ipodnano.h | 5 ++-- firmware/export/config-ipodvideo.h | 5 ++-- firmware/export/config-mrobe100.h | 2 +- firmware/export/config-sa9200.h | 3 +++ firmware/export/config.h | 51 ++++++++++++++++++++++++++++++++++- 20 files changed, 100 insertions(+), 94 deletions(-) (limited to 'firmware/export') diff --git a/firmware/export/backlight-sw-fading.h b/firmware/export/backlight-sw-fading.h index 54f732709a..8527fd0f99 100644 --- a/firmware/export/backlight-sw-fading.h +++ b/firmware/export/backlight-sw-fading.h @@ -22,10 +22,6 @@ #ifndef BACKLIGHT_THREAD_FADING_H #define BACKLIGHT_THREAD_FADING_H -#include "config.h" - -#ifdef USE_BACKLIGHT_SW_FADING - /* delay supposed to be MAX_BRIGHTNESS_SETTING*2 rounded to the next multiple * of 5, however not more than 40 */ #define _FADE_DELAY (((MAX_BRIGHTNESS_SETTING*2+4)/5)*5) @@ -41,6 +37,5 @@ enum { FADING_UP, FADING_DOWN, }; -#endif /* USE_BACKLIGHT_SW_FADING */ #endif /* _BACKLIGHT_THREAD_FADING_ */ diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h index cb081a5301..f215e0faea 100644 --- a/firmware/export/backlight.h +++ b/firmware/export/backlight.h @@ -34,12 +34,10 @@ void backlight_close(void); int backlight_get_current_timeout(void); -#if defined(HAVE_BACKLIGHT_PWM_FADING) +#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) void backlight_set_fade_in(int value); void backlight_set_fade_out(int value); -#endif -#if defined(USE_BACKLIGHT_SW_FADING) \ - || defined(USE_BACKLIGHT_CUSTOM_FADING_BOOL) +#elif defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING) void backlight_set_fade_in(bool value); void backlight_set_fade_out(bool value); #endif diff --git a/firmware/export/config-c200.h b/firmware/export/config-c200.h index d68d21455f..cd9f5867dc 100644 --- a/firmware/export/config-c200.h +++ b/firmware/export/config-c200.h @@ -111,6 +111,14 @@ #define HAVE_BACKLIGHT #define HAVE_BACKLIGHT_BRIGHTNESS +/* Main LCD backlight brightness range and defaults */ +#define MIN_BRIGHTNESS_SETTING 1 +#define MAX_BRIGHTNESS_SETTING 12 +#define DEFAULT_BRIGHTNESS_SETTING 6 + +/* Which backlight fading type? */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING + /* define this if you have a flash memory storage */ #define HAVE_FLASH_STORAGE @@ -138,12 +146,6 @@ /** Non-simulator section **/ #ifndef SIMULATOR -/* define this if the backlight thread is used for fade, not for sim, needs - * HAVE_BACKLIGHT_BRIGHTNESS */ -#ifndef BOOTLOADER -#define USE_BACKLIGHT_SW_FADING -#endif - /* Define this if you have a PortalPlayer PP5024 */ #define CONFIG_CPU PP5022 @@ -200,13 +202,6 @@ #endif /* SIMULATOR */ -/** Port-specific settings **/ - -/* Main LCD backlight brightness range and defaults */ -#define MIN_BRIGHTNESS_SETTING 1 -#define MAX_BRIGHTNESS_SETTING 12 -#define DEFAULT_BRIGHTNESS_SETTING 6 - /* Default recording levels */ #define DEFAULT_REC_MIC_GAIN 23 #define DEFAULT_REC_LEFT_GAIN 23 diff --git a/firmware/export/config-c200v2.h b/firmware/export/config-c200v2.h index 6ecb478c09..f6a386637c 100644 --- a/firmware/export/config-c200v2.h +++ b/firmware/export/config-c200v2.h @@ -136,12 +136,6 @@ /** Non-simulator section **/ #ifndef SIMULATOR -/* define this if the backlight thread is used for fade, not for sim, needs - * HAVE_BACKLIGHT_BRIGHTNESS */ -#ifndef BOOTLOADER -#define USE_BACKLIGHT_SW_FADING -#endif - /* Define this if you have a PortalPlayer PP5024 */ #define CONFIG_CPU AS3525 diff --git a/firmware/export/config-cowond2.h b/firmware/export/config-cowond2.h index edeb834ef7..2b3b09cb09 100644 --- a/firmware/export/config-cowond2.h +++ b/firmware/export/config-cowond2.h @@ -108,9 +108,10 @@ /* Define this for LCD backlight available */ #define HAVE_BACKLIGHT - /* Enable LCD brightness control */ #define HAVE_BACKLIGHT_BRIGHTNESS +/* Which backlight fading type? */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG /* Main LCD backlight brightness range and defaults */ #define MIN_BRIGHTNESS_SETTING 1 @@ -129,13 +130,6 @@ #define CONFIG_CHARGING CHARGING_SIMPLE #ifndef SIMULATOR - -/* define this if the backlight thread is used for fade, not for sim, needs - * HAVE_BACKLIGHT_BRIGHTNESS */ -#ifndef BOOTLOADER -#define USE_BACKLIGHT_SW_FADING -#endif - /* Define this if you have a TCC7801 */ #define CONFIG_CPU TCC7801 diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h index 2be64d95cc..7fba79679c 100644 --- a/firmware/export/config-e200.h +++ b/firmware/export/config-e200.h @@ -101,6 +101,9 @@ #define HAVE_BACKLIGHT #define HAVE_BACKLIGHT_BRIGHTNESS +/* Which backlight fading type? */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING + /* define this if the unit uses a scrollwheel for navigation */ #define HAVE_SCROLLWHEEL /* define from which rotation speed [degree/sec] on the acceleration starts */ @@ -135,12 +138,6 @@ /** Non-simulator section **/ #ifndef SIMULATOR -/* define this if the backlight thread is used for fade, not for sim, needs - * HAVE_BACKLIGHT_BRIGHTNESS */ -#ifndef BOOTLOADER -#define USE_BACKLIGHT_SW_FADING -#endif - /* Define this if you have a PortalPlayer PP5024 */ #define CONFIG_CPU PP5024 diff --git a/firmware/export/config-e200v2.h b/firmware/export/config-e200v2.h index 564916aea0..78246221be 100644 --- a/firmware/export/config-e200v2.h +++ b/firmware/export/config-e200v2.h @@ -106,6 +106,14 @@ #define HAVE_BACKLIGHT #define HAVE_BACKLIGHT_BRIGHTNESS +/* Main LCD backlight brightness range and defaults */ +#define MIN_BRIGHTNESS_SETTING 1 +#define MAX_BRIGHTNESS_SETTING 12 +#define DEFAULT_BRIGHTNESS_SETTING 6 + +/* Which backlight fading type? */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING + /* define this if the unit uses a scrollwheel for navigation */ #define HAVE_SCROLLWHEEL /* define from which rotation speed [degree/sec] on the acceleration starts */ @@ -134,12 +142,6 @@ /** Non-simulator section **/ #ifndef SIMULATOR -/* define this if the backlight thread is used for fade, not for sim, needs - * HAVE_BACKLIGHT_BRIGHTNESS */ -#ifndef BOOTLOADER -#define USE_BACKLIGHT_SW_FADING -#endif - /* Define this if you have an AMS AS3525*/ #define CONFIG_CPU AS3525 @@ -195,13 +197,6 @@ #endif /* SIMULATOR */ -/** Port-specific settings **/ - -/* Main LCD backlight brightness range and defaults */ -#define MIN_BRIGHTNESS_SETTING 1 -#define MAX_BRIGHTNESS_SETTING 12 -#define DEFAULT_BRIGHTNESS_SETTING 6 - /* Default recording levels */ #define DEFAULT_REC_MIC_GAIN 23 #define DEFAULT_REC_LEFT_GAIN 23 diff --git a/firmware/export/config-fuze.h b/firmware/export/config-fuze.h index 3e5880775b..0bc2d70bf7 100644 --- a/firmware/export/config-fuze.h +++ b/firmware/export/config-fuze.h @@ -106,6 +106,14 @@ #define HAVE_BACKLIGHT #define HAVE_BACKLIGHT_BRIGHTNESS +/* Main LCD backlight brightness range and defaults */ +#define MIN_BRIGHTNESS_SETTING 1 +#define MAX_BRIGHTNESS_SETTING 12 +#define DEFAULT_BRIGHTNESS_SETTING 6 + +/* Which backlight fading type? */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING + /* define this if the unit uses a scrollwheel for navigation */ #define HAVE_SCROLLWHEEL /* define from which rotation speed [degree/sec] on the acceleration starts */ @@ -134,12 +142,6 @@ /** Non-simulator section **/ #ifndef SIMULATOR -/* define this if the backlight thread is used for fade, not for sim, needs - * HAVE_BACKLIGHT_BRIGHTNESS */ -#ifndef BOOTLOADER -#define USE_BACKLIGHT_SW_FADING -#endif - /* Define this if you have an AMS AS3525*/ #define CONFIG_CPU AS3525 @@ -195,13 +197,6 @@ #endif /* SIMULATOR */ -/** Port-specific settings **/ - -/* Main LCD backlight brightness range and defaults */ -#define MIN_BRIGHTNESS_SETTING 1 -#define MAX_BRIGHTNESS_SETTING 12 -#define DEFAULT_BRIGHTNESS_SETTING 6 - /* Default recording levels */ #define DEFAULT_REC_MIC_GAIN 23 #define DEFAULT_REC_LEFT_GAIN 23 diff --git a/firmware/export/config-gigabeat-s.h b/firmware/export/config-gigabeat-s.h index 93068ae441..6b993b6082 100644 --- a/firmware/export/config-gigabeat-s.h +++ b/firmware/export/config-gigabeat-s.h @@ -117,15 +117,14 @@ #define MAX_BRIGHTNESS_SETTING 24 #define DEFAULT_BRIGHTNESS_SETTING 12 +/* Implementation-defined fading type with bool settings */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_TARGET #define HAVE_HEADPHONE_DETECTION #endif /* BOOTLOADER */ #ifndef SIMULATOR -/* Implementation-defined fading type with bool settings */ -#define USE_BACKLIGHT_CUSTOM_FADING_BOOL - /* The LCD on a Gigabeat is 240x320 - it is portrait */ #define HAVE_PORTRAIT_LCD diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index be718259f8..6ca2a0701e 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -74,7 +74,7 @@ #define HAVE_BACKLIGHT /* We can fade the backlight by using PWM */ -#define HAVE_BACKLIGHT_PWM_FADING +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index 4757d7708c..74074e83e0 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h @@ -69,7 +69,7 @@ #define HAVE_BACKLIGHT /* We can fade the backlight by using PWM */ -#define HAVE_BACKLIGHT_PWM_FADING +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 05d75fc4f0..037bb26b2d 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -68,6 +68,8 @@ /* Define this for LCD backlight available */ #define HAVE_BACKLIGHT #define HAVE_BACKLIGHT_BRIGHTNESS +/* Which backlight fading type? */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF @@ -125,12 +127,6 @@ #ifndef SIMULATOR -/* define this if the backlight thread is used for fade, not for sim, needs - * HAVE_BACKLIGHT_BRIGHTNESS */ -#ifndef BOOTLOADER -#define USE_BACKLIGHT_SW_FADING -#endif - /* Define this if your LCD can be enabled/disabled */ #define HAVE_LCD_ENABLE diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index 8b1f9086bb..27bd2c523b 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h @@ -90,6 +90,8 @@ /* Define this for LCD backlight available */ #define HAVE_BACKLIGHT #define HAVE_BACKLIGHT_BRIGHTNESS +/* Which backlight fading type? */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG /* define this if you have a disk storage, i.e. something that needs spinups and can cause skips when shaked */ @@ -127,12 +129,6 @@ #ifndef SIMULATOR -/* define this if the backlight thread is used for fade, not for sim, needs - * HAVE_BACKLIGHT_BRIGHTNESS */ -#ifndef BOOTLOADER -#define USE_BACKLIGHT_SW_FADING -#endif - /* Define this if your LCD can set contrast */ #define HAVE_LCD_CONTRAST diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index 210eb1d717..bc59ededfe 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h @@ -101,7 +101,7 @@ #define HAVE_BACKLIGHT /* We can fade the backlight by using PWM */ -#define HAVE_BACKLIGHT_PWM_FADING +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM /* Define this if you can detect headphones */ #define HAVE_HEADPHONE_DETECTION diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index 49630d7b3d..4775350712 100644 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h @@ -101,7 +101,7 @@ #define HAVE_BACKLIGHT /* We can fade the backlight by using PWM */ -#define HAVE_BACKLIGHT_PWM_FADING +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM /* define this if the unit uses a scrollwheel for navigation */ #define HAVE_SCROLLWHEEL diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index 8752181bb9..1d82ec4428 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h @@ -81,15 +81,14 @@ /* Define this for LCD backlight available */ #define HAVE_BACKLIGHT #define HAVE_BACKLIGHT_BRIGHTNESS +/* We can fade the backlight by using PWM */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM /* Main LCD backlight brightness range and defaults */ #define MIN_BRIGHTNESS_SETTING 1 #define MAX_BRIGHTNESS_SETTING 32 #define DEFAULT_BRIGHTNESS_SETTING 16 -/* We can fade the backlight by using PWM */ -#define HAVE_BACKLIGHT_PWM_FADING - /* define this if the unit uses a scrollwheel for navigation */ #define HAVE_SCROLLWHEEL /* define from which rotation speed [degree/sec] on the acceleration starts */ diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index ab974dc236..b658a9b3f8 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h @@ -86,13 +86,14 @@ #define HAVE_BACKLIGHT #define HAVE_BACKLIGHT_BRIGHTNESS +/* We can fade the backlight by using PWM */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM + /* Main LCD backlight brightness range and defaults */ #define MIN_BRIGHTNESS_SETTING 1 #define MAX_BRIGHTNESS_SETTING 32 #define DEFAULT_BRIGHTNESS_SETTING 16 -/* We can fade the backlight by using PWM */ -#define HAVE_BACKLIGHT_PWM_FADING /* define this if the unit uses a scrollwheel for navigation */ #define HAVE_SCROLLWHEEL diff --git a/firmware/export/config-mrobe100.h b/firmware/export/config-mrobe100.h index 4ade179c04..f2fc5cb37a 100644 --- a/firmware/export/config-mrobe100.h +++ b/firmware/export/config-mrobe100.h @@ -70,7 +70,7 @@ #define HAVE_BACKLIGHT /* We can fade the backlight by using PWM */ -#define HAVE_BACKLIGHT_PWM_FADING +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM /* Main LCD backlight brightness range and defaults */ #define MIN_BRIGHTNESS_SETTING 1 diff --git a/firmware/export/config-sa9200.h b/firmware/export/config-sa9200.h index b9fd4575bc..624befcf12 100755 --- a/firmware/export/config-sa9200.h +++ b/firmware/export/config-sa9200.h @@ -90,6 +90,9 @@ #define MAX_BRIGHTNESS_SETTING 12 #define DEFAULT_BRIGHTNESS_SETTING 6 +/* Which backlight fading type? */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING + /* define this if you have a flash memory storage */ #define HAVE_FLASH_STORAGE diff --git a/firmware/export/config.h b/firmware/export/config.h index 7fb41d8d83..58ae66d1cd 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -113,6 +113,24 @@ #define H300_REMOTE 2 #define X5_REMOTE 3 +/* CONFIG_BACKLIGHT_FADING */ +/* No fading capabilities at all (yet) */ +#define BACKLIGHT_NO_FADING 0x0 +/* Backlight fading is controlled using a hardware PWM mechanism */ +#define BACKLIGHT_FADING_PWM 0x1 +/* Backlight is controlled using a software implementation + * BACKLIGHT_FADING_SW_SETTING means that backlight is turned on by only setting + * the brightness (i.e. no real difference between backlight_on and + * backlight_set_brightness) + * BACKLIGHT_FADING_SW_SETTING means that backlight brightness is restored + * "in hardware", from a hardware register upon backlight_on + * Both types need to have minor adjustments in the software fading code */ +#define BACKLIGHT_FADING_SW_SETTING 0x2 +#define BACKLIGHT_FADING_SW_HW_REG 0x4 +/* Backlight fading is done in a target specific way + * for example in hardware, but not controllable*/ +#define BACKLIGHT_FADING_TARGET 0x8 + /* CONFIG_CHARGING */ /* Generic types */ @@ -348,7 +366,12 @@ #include "config_caps.h" /* now set any CONFIG_ defines correctly if they are not used, - No need to do this on CONFIG_'s which are compulsary (e.g CONFIG_CODEC ) */ + No need to do this on CONFIG_'s which are compulsory (e.g CONFIG_CODEC ) */ + +#if !defined(CONFIG_BACKLIGHT_FADING) +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING +#endif + #ifndef CONFIG_TUNER #define CONFIG_TUNER 0 #endif @@ -413,6 +436,32 @@ #define CONFIG_STORAGE_MULTI #endif +/* deactive fading in bootloader/sim */ +#if defined(BOOTLOADER) || defined(SIMULATOR) +#undef CONFIG_BACKLIGHT_FADING +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING +#endif + +/* determine which setting/manual text to use, + * possibly overridden in target config */ +#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM) + +#ifndef HAVE_BACKLIGHT_FADING_INT_SETTING +#define HAVE_BACKLIGHT_FADING_INT_SETTING +#endif + +#elif (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \ + || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG) \ + || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_TARGET) + +/* BACKLIGHT_FADING_TARGET may the setting to use */ +#if !defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING) \ + && !defined(HAVE_BACKLIGHT_FADING_INT_SETTING) +#define HAVE_BACKLIGHT_FADING_BOOL_SETTING +#endif + +#endif /* CONFIG_BACKLIGHT_FADING */ + #if defined(BOOTLOADER) && defined(HAVE_ADJUSTABLE_CPU_FREQ) /* Bootloaders don't use CPU frequency adjustment */ #undef HAVE_ADJUSTABLE_CPU_FREQ -- cgit v1.2.3