summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2007-05-08 06:45:38 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2007-05-08 06:45:38 +0000
commit6f95ab7de7370bc8d5c803d22984908f6174a0e3 (patch)
treeb69ab3bb886ca4ad5d17cd3283ee21aa19751533 /firmware/target/arm
parent830576bb0b08dca0f5e9a90bf0526505b1c34a0a (diff)
Add in buttonlight brightness setting for the Gigabeat, and setup the framework for future players that have adjustable button light brightness settings. Also fixed a bug in the backlight code when the brightness was set to 0.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13356 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c39
1 files changed, 34 insertions, 5 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 7b7e8518ec..40b093c689 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c
@@ -31,6 +31,7 @@
static void led_control_service(void);
static unsigned short backlight_brightness;
+static unsigned short buttonlight_brightness;
static unsigned short backlight_target;
static unsigned short buttonlight_target;
@@ -57,6 +58,7 @@ enum buttonlight_states
BUTTONLIGHT_CONTROL_IDLE,
BUTTONLIGHT_CONTROL_OFF,
BUTTONLIGHT_CONTROL_ON,
+ BUTTONLIGHT_CONTROL_SET,
BUTTONLIGHT_CONTROL_FADE,
} buttonlight_control;
@@ -214,10 +216,15 @@ static void led_control_service(void)
break;
case BUTTONLIGHT_CONTROL_ON:
sc606_changed=true;
- sc606regBval=sc606regCval=backlight_brightness;
+ sc606regBval=sc606regCval=buttonlight_brightness;
sc606regCONFval |= 0x3C;
buttonlight_control=BUTTONLIGHT_CONTROL_IDLE;
break;
+ case BUTTONLIGHT_CONTROL_SET:
+ sc606regBval=sc606regCval=buttonlight_brightness;
+ sc606_changed=true;
+ buttonlight_control = BUTTONLIGHT_CONTROL_ON;
+ break;
case BUTTONLIGHT_CONTROL_FADE:
/* Was this mode set while the button light is already on/off? */
if(buttonlight_target==sc606regBval)
@@ -288,15 +295,21 @@ static void led_control_service(void)
void __button_backlight_on(void)
{
buttonlight_control = BUTTONLIGHT_CONTROL_IDLE;
- buttonlight_target = backlight_brightness;
- buttonlight_control = BUTTONLIGHT_CONTROL_FADE;
+ buttonlight_target = buttonlight_brightness;
+ if(buttonlight_brightness==0)
+ buttonlight_control = BUTTONLIGHT_CONTROL_ON;
+ else
+ buttonlight_control = BUTTONLIGHT_CONTROL_FADE;
}
void __button_backlight_off(void)
{
buttonlight_control = BUTTONLIGHT_CONTROL_IDLE;
buttonlight_target = 0;
- buttonlight_control = BUTTONLIGHT_CONTROL_FADE;
+ if(buttonlight_brightness==0)
+ buttonlight_control = BUTTONLIGHT_CONTROL_OFF;
+ else
+ buttonlight_control = BUTTONLIGHT_CONTROL_FADE;
}
void __backlight_dim(bool dim_now)
@@ -304,5 +317,21 @@ void __backlight_dim(bool dim_now)
/* dont let the interrupt tick happen */
backlight_control = BACKLIGHT_CONTROL_IDLE;
backlight_target = (dim_now == true) ? 0 : backlight_brightness;
- backlight_control = BACKLIGHT_CONTROL_FADE;
+ if(backlight_target==0 && backlight_brightness==0)
+ {
+ if(dim_now == false)
+ backlight_control = BACKLIGHT_CONTROL_ON;
+ else
+ backlight_control = BACKLIGHT_CONTROL_OFF;
+ }
+ else
+ backlight_control = BACKLIGHT_CONTROL_FADE;
+}
+
+void __buttonlight_set_brightness(int brightness)
+{
+ /* stop the interrupt from messing us up */
+ buttonlight_control = BUTTONLIGHT_CONTROL_IDLE;
+ buttonlight_brightness = brightness;
+ buttonlight_control = BUTTONLIGHT_CONTROL_SET;
}