summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2007-05-08 05:47:36 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2007-05-08 05:47:36 +0000
commit830576bb0b08dca0f5e9a90bf0526505b1c34a0a (patch)
tree9d793b00c192fb0b78b9b6280391c8c6fad69a2f /firmware/target/arm
parent7ef0af07f17a51ed814285847f55d8d12bef67c7 (diff)
Few more code cleanups to the button light work. This reduces the flickering of the backlight when a button is held (fewer sc606 writes).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13355 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c25
1 files changed, 14 insertions, 11 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 7e143fee8e..7b7e8518ec 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c
@@ -55,16 +55,9 @@ static enum sc606_states
enum buttonlight_states
{
BUTTONLIGHT_CONTROL_IDLE,
-
- /* turn button lights off */
BUTTONLIGHT_CONTROL_OFF,
-
- /* turns button lights on to setting */
BUTTONLIGHT_CONTROL_ON,
-
- /* buttonlights follow the backlight settings */
BUTTONLIGHT_CONTROL_FADE,
-
} buttonlight_control;
static unsigned short buttonlight_trigger_now;
@@ -134,8 +127,6 @@ void __buttonlight_mode(enum buttonlight_mode mode)
default:
return; /* unknown mode */
}
-
-
}
/*
@@ -162,7 +153,7 @@ static void led_control_service(void)
sc606regCONFval=3;
static bool sc606_changed=true;
-
+
if(sc606_changed==false)
{
switch (backlight_control)
@@ -186,6 +177,12 @@ static void led_control_service(void)
backlight_control = BACKLIGHT_CONTROL_ON;
break;
case BACKLIGHT_CONTROL_FADE:
+ /* Was this mode set while the backlight is already on/off? */
+ if(backlight_target==sc606regAval)
+ {
+ backlight_control = BACKLIGHT_CONTROL_IDLE;
+ break;
+ }
sc606_changed=true;
sc606regCONFval |= 0x03;
if(backlight_target>sc606regAval)
@@ -222,6 +219,12 @@ static void led_control_service(void)
buttonlight_control=BUTTONLIGHT_CONTROL_IDLE;
break;
case BUTTONLIGHT_CONTROL_FADE:
+ /* Was this mode set while the button light is already on/off? */
+ if(buttonlight_target==sc606regBval)
+ {
+ buttonlight_control=BUTTONLIGHT_CONTROL_IDLE;
+ break;
+ }
sc606_changed=true;
sc606regCONFval |= 0x3C;
if(buttonlight_target>sc606regBval)
@@ -275,7 +278,7 @@ static void led_control_service(void)
sc606_control=SC606_CONTROL_A12;
break;
}
-
+
if(sc606regCONFval&0x03)
lcd_enable(true);
else