1
0
Fork 0
forked from len0rd/rockbox

SA9200: Implement the backlight hold handling.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29030 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2011-01-11 04:51:24 +00:00
parent ce703c85d9
commit 6a73367ee6

View file

@ -30,6 +30,8 @@
static int int_btn = BUTTON_NONE; static int int_btn = BUTTON_NONE;
#ifndef BOOTLOADER #ifndef BOOTLOADER
static bool hold_button_old = false;
void button_init_device(void) void button_init_device(void)
{ {
/* The touchpad is powered on and initialized in power-sa9200.c /* The touchpad is powered on and initialized in power-sa9200.c
@ -72,8 +74,10 @@ void button_int(void)
} }
} }
#else #else
void button_init_device(void){} void button_init_device(void)
#endif /* bootloader */ {
}
#endif /* BOOTLOADER */
bool button_hold(void) bool button_hold(void)
{ {
@ -86,8 +90,18 @@ bool button_hold(void)
int button_read_device(void) int button_read_device(void)
{ {
int btn = int_btn; int btn = int_btn;
bool hold = !(GPIOL_INPUT_VAL & 0x40);
if (button_hold()) #ifndef BOOTLOADER
/* Backlight hold handling */
if (hold != hold_button_old)
{
hold_button_old = hold;
backlight_hold_changed(hold);
}
#endif
if (hold)
return BUTTON_NONE; return BUTTON_NONE;
if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER; if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER;