summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2008-01-25 18:05:21 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2008-01-25 18:05:21 +0000
commit7dff491a720383554ce4fc2277f2cd1eb9f4f531 (patch)
tree3aa7b021513264fdca137f4b9a6b9f6b24f9540f
parentfe99a8e3dad38dcee94b9e3cfc53214129d9b863 (diff)
downloadrockbox-7dff491a720383554ce4fc2277f2cd1eb9f4f531.zip
rockbox-7dff491a720383554ce4fc2277f2cd1eb9f4f531.tar.gz
rockbox-7dff491a720383554ce4fc2277f2cd1eb9f4f531.tar.bz2
rockbox-7dff491a720383554ce4fc2277f2cd1eb9f4f531.tar.xz
- make the booloader compile again
- make the brightness table static - also use the logarithmic scale for the button lights git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16162 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c8
1 files changed, 6 insertions, 2 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 913deab..076c06b 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c
@@ -28,9 +28,10 @@
#define BUTTONLIGHT_MENU (SC606_LED_B1)
#define BUTTONLIGHT_ALL (SC606_LED_B1 | SC606_LED_B2 | SC606_LED_C1 | SC606_LED_C2)
+static const int log_brightness[12] = {0,1,2,3,5,7,10,15,22,31,44,63};
+
#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
{
@@ -390,8 +391,11 @@ void _buttonlight_off(void)
void _buttonlight_set_brightness(int brightness)
{
+ /* clamp the brightness value */
+ brightness = MAX(1, MIN(12, brightness));
+ /* stop the interrupt from messing us up */
buttonlight_control = BUTTONLIGHT_CONTROL_IDLE;
- buttonlight_brightness = brightness;
+ buttonlight_brightness = log_brightness[brightness - 1];
buttonlight_control = BUTTONLIGHT_CONTROL_SET;
}