summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s3c2440/gigabeat-fx
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/s3c2440/gigabeat-fx')
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c70
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/backlight-target.h22
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c4
3 files changed, 52 insertions, 44 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 c132be5f69..ee8801f99b 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c
@@ -67,18 +67,8 @@ static unsigned char buttonlight_target;
static unsigned short buttonlight_trigger_now;
-void __backlight_on(void)
-{
- backlight_control = BACKLIGHT_CONTROL_ON;
-}
-
-void __backlight_off(void)
-{
- backlight_control = BACKLIGHT_CONTROL_OFF;
-}
-
/* Assumes that the backlight has been initialized */
-void __backlight_set_brightness(int brightness)
+void _backlight_set_brightness(int brightness)
{
/* stop the interrupt from messing us up */
backlight_control = BACKLIGHT_CONTROL_IDLE;
@@ -328,17 +318,44 @@ static void led_control_service(void)
}
#endif /* BOOTLOADER */
-void __buttonlight_on(void)
+static 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;
+ 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 _backlight_on(void)
+{
+ lcd_enable(true);
+ __backlight_dim(false);
+}
+
+void _backlight_off(void)
+{
+ __backlight_dim(true);
+}
+
+static inline void __buttonlight_on(void)
{
buttonlight_control = BUTTONLIGHT_CONTROL_ON;
}
-void __buttonlight_off(void)
+static inline void __buttonlight_off(void)
{
buttonlight_control = BUTTONLIGHT_CONTROL_OFF;
}
-void __buttonlight_dim(bool dim_now)
+static void __buttonlight_dim(bool dim_now)
{
buttonlight_control = BUTTONLIGHT_CONTROL_IDLE;
buttonlight_target = (dim_now == true) ? 0 : buttonlight_brightness;
@@ -353,30 +370,27 @@ void __buttonlight_dim(bool dim_now)
buttonlight_control = BUTTONLIGHT_CONTROL_FADE;
}
-void __backlight_dim(bool dim_now)
+void _buttonlight_on(void)
{
- /* dont let the interrupt tick happen */
- backlight_control = BACKLIGHT_CONTROL_IDLE;
- backlight_target = (dim_now == true) ? 0 : backlight_brightness;
- if(backlight_target==0 && backlight_brightness==0)
- {
- if(dim_now == false)
- backlight_control = BACKLIGHT_CONTROL_ON;
- else
- backlight_control = BACKLIGHT_CONTROL_OFF;
- }
+ __buttonlight_dim(false);
+}
+
+void _buttonlight_off(void)
+{
+ if(_buttonlight_timeout>0)
+ __buttonlight_dim(true);
else
- backlight_control = BACKLIGHT_CONTROL_FADE;
+ __buttonlight_off();
}
-void __buttonlight_set_brightness(int brightness)
+void _buttonlight_set_brightness(int brightness)
{
buttonlight_control = BUTTONLIGHT_CONTROL_IDLE;
buttonlight_brightness = brightness;
buttonlight_control = BUTTONLIGHT_CONTROL_SET;
}
-bool __backlight_init(void)
+bool _backlight_init(void)
{
buttonlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/backlight-target.h b/firmware/target/arm/s3c2440/gigabeat-fx/backlight-target.h
index 0589557791..b899cc977c 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/backlight-target.h
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/backlight-target.h
@@ -41,18 +41,12 @@ void __buttonlight_trigger(void);
/* See enum buttonlight_mode for available functions */
void __buttonlight_mode(enum buttonlight_mode mode);
-bool __backlight_init(void);
-void __backlight_on(void);
-void __backlight_off(void);
-void __backlight_set_brightness(int brightness);
-
-void __buttonlight_set_brightness(int brightness);
-
-void __buttonlight_on(void);
-void __buttonlight_off(void);
-
-/* true: backlight fades off - false: backlight fades on */
-void __backlight_dim(bool dim);
-void __buttonlight_dim(bool dim_now);
-
+bool _backlight_init(void);
+void _backlight_on(void);
+void _backlight_off(void);
+void _backlight_set_brightness(int brightness);
+
+void _buttonlight_set_brightness(int brightness);
+void _buttonlight_on(void);
+void _buttonlight_off(void);
#endif
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c
index ac37908b05..b9da66e025 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c
@@ -63,8 +63,8 @@ bool ide_powered(void)
void power_off(void)
{
/* turn off backlight and wait for 1 second */
- __backlight_off();
- __buttonlight_off();
+ _backlight_off();
+ _buttonlight_off();
sleep(HZ);
/* set SLEEP bit to on in CLKCON to turn off */
CLKCON |=(1<<3);