From da5fb18bca90ec09b99f28186787d10378a92109 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Fri, 24 Mar 2006 13:47:24 +0000 Subject: New option: First keypress enables backlight only. Patch #2920 by Nicolas Pennequin. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9228 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/button.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'firmware/drivers/button.c') diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index dbdb171bf2..9e649ead5a 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -52,6 +52,9 @@ static long last_read; /* Last button status, for debouncing/filtering */ #ifdef HAVE_LCD_BITMAP static bool flipped; /* buttons can be flipped to match the LCD flip */ #endif +#ifdef CONFIG_BACKLIGHT +static bool filter_first_keypress; +#endif /* how often we check to see if a button is pressed */ #define POLL_FREQUENCY HZ/100 @@ -504,7 +507,10 @@ static void button_tick(void) } else { - queue_post(&button_queue, btn, NULL); +#ifdef CONFIG_BACKLIGHT + if ( !filter_first_keypress || is_backlight_on()) +#endif + queue_post(&button_queue, btn, NULL); post = false; } #ifdef HAVE_REMOTE_LCD @@ -629,6 +635,9 @@ void button_init(void) #ifdef HAVE_LCD_BITMAP flipped = false; #endif +#ifdef CONFIG_BACKLIGHT + filter_first_keypress = false; +#endif } #ifdef HAVE_LCD_BITMAP /* only bitmap displays can be flipped */ @@ -687,6 +696,13 @@ void button_set_flip(bool flip) } #endif /* HAVE_LCD_BITMAP */ +#ifdef CONFIG_BACKLIGHT +void set_backlight_filter_keypress(bool value) +{ + filter_first_keypress = value; +} +#endif + /* Archos hardware button hookup ============================= -- cgit v1.2.3