summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2008-01-25 17:51:05 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2008-01-25 17:51:05 +0000
commitfe99a8e3dad38dcee94b9e3cfc53214129d9b863 (patch)
tree709d484fc3f9cd80b629006f6543e69e6d444633
parent8af4b3c851fa0b2aa6d0787e06f4ee33fe4f9784 (diff)
downloadrockbox-fe99a8e3dad38dcee94b9e3cfc53214129d9b863.tar.gz
rockbox-fe99a8e3dad38dcee94b9e3cfc53214129d9b863.zip
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
-rw-r--r--firmware/export/config-gigabeat.h6
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c5
2 files changed, 7 insertions, 4 deletions
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h
index 62e7e26713..70664262d8 100644
--- a/firmware/export/config-gigabeat.h
+++ b/firmware/export/config-gigabeat.h
@@ -56,9 +56,9 @@
56#define HAVE_BUTTONLIGHT_BRIGHTNESS 56#define HAVE_BUTTONLIGHT_BRIGHTNESS
57 57
58/* Main LCD backlight brightness range and defaults */ 58/* Main LCD backlight brightness range and defaults */
59#define MIN_BRIGHTNESS_SETTING 0 /* 0.5 mA */ 59#define MIN_BRIGHTNESS_SETTING 1 /* 0.5 mA */
60#define MAX_BRIGHTNESS_SETTING 63 /* 32 mA */ 60#define MAX_BRIGHTNESS_SETTING 12 /* 32 mA */
61#define DEFAULT_BRIGHTNESS_SETTING 39 /* 20 mA */ 61#define DEFAULT_BRIGHTNESS_SETTING 10 /* 16 mA */
62 62
63/* Define this if you have a software controlled poweroff */ 63/* Define this if you have a software controlled poweroff */
64#define HAVE_SW_POWEROFF 64#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 645f3c1e09..913deab371 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 @@
30 30
31#ifndef BOOTLOADER 31#ifndef BOOTLOADER
32static void led_control_service(void); 32static void led_control_service(void);
33const int log_brightness[12] = {0,1,2,3,5,7,10,15,22,31,44,63};
33 34
34static enum sc606_states 35static enum sc606_states
35{ 36{
@@ -70,9 +71,11 @@ static unsigned short buttonlight_trigger_now;
70/* Assumes that the backlight has been initialized */ 71/* Assumes that the backlight has been initialized */
71void _backlight_set_brightness(int brightness) 72void _backlight_set_brightness(int brightness)
72{ 73{
74 /* clamp the brightness value */
75 brightness = MAX(1, MIN(12, brightness));
73 /* stop the interrupt from messing us up */ 76 /* stop the interrupt from messing us up */
74 backlight_control = BACKLIGHT_CONTROL_IDLE; 77 backlight_control = BACKLIGHT_CONTROL_IDLE;
75 backlight_brightness = brightness; 78 backlight_brightness = log_brightness[brightness - 1];
76 backlight_control = BACKLIGHT_CONTROL_SET; 79 backlight_control = BACKLIGHT_CONTROL_SET;
77} 80}
78 81