From fe99a8e3dad38dcee94b9e3cfc53214129d9b863 Mon Sep 17 00:00:00 2001 From: Marcoen Hirschberg Date: Fri, 25 Jan 2008 17:51:05 +0000 Subject: make the brightness setting logarithmic, which looks linear to the eye git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16161 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config-gigabeat.h | 6 +++--- firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index 62e7e26..7066426 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h @@ -56,9 +56,9 @@ #define HAVE_BUTTONLIGHT_BRIGHTNESS /* Main LCD backlight brightness range and defaults */ -#define MIN_BRIGHTNESS_SETTING 0 /* 0.5 mA */ -#define MAX_BRIGHTNESS_SETTING 63 /* 32 mA */ -#define DEFAULT_BRIGHTNESS_SETTING 39 /* 20 mA */ +#define MIN_BRIGHTNESS_SETTING 1 /* 0.5 mA */ +#define MAX_BRIGHTNESS_SETTING 12 /* 32 mA */ +#define DEFAULT_BRIGHTNESS_SETTING 10 /* 16 mA */ /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c index 645f3c1..913deab 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c @@ -30,6 +30,7 @@ #ifndef BOOTLOADER static void led_control_service(void); +const int log_brightness[12] = {0,1,2,3,5,7,10,15,22,31,44,63}; static enum sc606_states { @@ -70,9 +71,11 @@ static unsigned short buttonlight_trigger_now; /* Assumes that the backlight has been initialized */ void _backlight_set_brightness(int brightness) { + /* clamp the brightness value */ + brightness = MAX(1, MIN(12, brightness)); /* stop the interrupt from messing us up */ backlight_control = BACKLIGHT_CONTROL_IDLE; - backlight_brightness = brightness; + backlight_brightness = log_brightness[brightness - 1]; backlight_control = BACKLIGHT_CONTROL_SET; } -- cgit v1.1