From 6a73367ee69a252bc53332d8ed82be5921b9531c Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Tue, 11 Jan 2011 04:51:24 +0000 Subject: SA9200: Implement the backlight hold handling. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29030 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/philips/sa9200/button-sa9200.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'firmware') diff --git a/firmware/target/arm/philips/sa9200/button-sa9200.c b/firmware/target/arm/philips/sa9200/button-sa9200.c index 9fab3d4068..e3d569f422 100644 --- a/firmware/target/arm/philips/sa9200/button-sa9200.c +++ b/firmware/target/arm/philips/sa9200/button-sa9200.c @@ -30,6 +30,8 @@ static int int_btn = BUTTON_NONE; #ifndef BOOTLOADER +static bool hold_button_old = false; + void button_init_device(void) { /* The touchpad is powered on and initialized in power-sa9200.c @@ -72,8 +74,10 @@ void button_int(void) } } #else -void button_init_device(void){} -#endif /* bootloader */ +void button_init_device(void) +{ +} +#endif /* BOOTLOADER */ bool button_hold(void) { @@ -86,8 +90,18 @@ bool button_hold(void) int button_read_device(void) { int btn = int_btn; + bool hold = !(GPIOL_INPUT_VAL & 0x40); + +#ifndef BOOTLOADER + /* Backlight hold handling */ + if (hold != hold_button_old) + { + hold_button_old = hold; + backlight_hold_changed(hold); + } +#endif - if (button_hold()) + if (hold) return BUTTON_NONE; if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER; -- cgit v1.2.3