summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/button-e200.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/firmware/target/arm/sandisk/sansa-e200/button-e200.c b/firmware/target/arm/sandisk/sansa-e200/button-e200.c
index 7a297885c0..0490c454c8 100644
--- a/firmware/target/arm/sandisk/sansa-e200/button-e200.c
+++ b/firmware/target/arm/sandisk/sansa-e200/button-e200.c
@@ -31,12 +31,29 @@
static unsigned int old_wheel_value = 0;
static unsigned int wheel_repeat = BUTTON_NONE;
+/* Wheel backlight control */
+#define WHEEL_BACKLIGHT_TIMEOUT 5*HZ;
+static unsigned int wheel_backlight_timer;
+
+void wheel_backlight_on(bool enable)
+{
+ if(enable)
+ GPIOG_OUTPUT_VAL |=0x80;
+ else
+ GPIOG_OUTPUT_VAL &=~ 0x80;
+}
+
void button_init_device(void)
{
/* Enable all buttons */
GPIOF_ENABLE |= 0xff;
GPIOH_ENABLE |= 0xc0;
+ /* Scrollwheel light - enable control through GPIOG pin 7 and set timeout */
+ GPIOG_ENABLE = 0x80;
+ GPIOG_OUTPUT_EN |= 0x80;
+ wheel_backlight_timer = WHEEL_BACKLIGHT_TIMEOUT;
+
/* Read initial wheel value (bit 6-7 of GPIOH) */
old_wheel_value = GPIOH_INPUT_VAL & 0xc0;
}
@@ -137,6 +154,20 @@ int button_read_device(void)
old_wheel_value = new_wheel_value;
}
-
+
+ if(wheel_backlight_timer>0){
+ wheel_backlight_timer--;
+ if(wheel_backlight_timer==0){
+ wheel_backlight_on(false);
+ }
+ }
+
+ if( (btn & BUTTON_SCROLL_UP) || (btn & BUTTON_SCROLL_DOWN) ){
+ if(wheel_backlight_timer==0){
+ wheel_backlight_on(true);
+ }
+ wheel_backlight_timer = WHEEL_BACKLIGHT_TIMEOUT;
+ }
+
return btn;
}