diff options
author | Marcoen Hirschberg <marcoen@gmail.com> | 2008-01-25 17:51:05 +0000 |
---|---|---|
committer | Marcoen Hirschberg <marcoen@gmail.com> | 2008-01-25 17:51:05 +0000 |
commit | fe99a8e3dad38dcee94b9e3cfc53214129d9b863 (patch) | |
tree | 709d484fc3f9cd80b629006f6543e69e6d444633 /firmware/target/arm/s3c2440/gigabeat-fx | |
parent | 8af4b3c851fa0b2aa6d0787e06f4ee33fe4f9784 (diff) |
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
Diffstat (limited to 'firmware/target/arm/s3c2440/gigabeat-fx')
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c | 5 |
1 files changed, 4 insertions, 1 deletions
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 @@ #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; } |