summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/backlight.c8
-rw-r--r--firmware/drivers/button.c18
-rw-r--r--firmware/export/backlight.h1
-rw-r--r--firmware/export/button.h3
4 files changed, 29 insertions, 1 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 66aa2d7c6c..a04000a426 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -522,6 +522,14 @@ void backlight_off(void)
522 queue_post(&backlight_queue, BACKLIGHT_OFF, NULL); 522 queue_post(&backlight_queue, BACKLIGHT_OFF, NULL);
523} 523}
524 524
525bool is_backlight_on(void)
526{
527 if (backlight_timer || !backlight_get_current_timeout())
528 return true;
529 else
530 return false;
531}
532
525/* return value in ticks; 0 means always on, <0 means always off */ 533/* return value in ticks; 0 means always on, <0 means always off */
526int backlight_get_current_timeout(void) 534int backlight_get_current_timeout(void)
527{ 535{
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 */
52#ifdef HAVE_LCD_BITMAP 52#ifdef HAVE_LCD_BITMAP
53static bool flipped; /* buttons can be flipped to match the LCD flip */ 53static bool flipped; /* buttons can be flipped to match the LCD flip */
54#endif 54#endif
55#ifdef CONFIG_BACKLIGHT
56static bool filter_first_keypress;
57#endif
55 58
56/* how often we check to see if a button is pressed */ 59/* how often we check to see if a button is pressed */
57#define POLL_FREQUENCY HZ/100 60#define POLL_FREQUENCY HZ/100
@@ -504,7 +507,10 @@ static void button_tick(void)
504 } 507 }
505 else 508 else
506 { 509 {
507 queue_post(&button_queue, btn, NULL); 510#ifdef CONFIG_BACKLIGHT
511 if ( !filter_first_keypress || is_backlight_on())
512#endif
513 queue_post(&button_queue, btn, NULL);
508 post = false; 514 post = false;
509 } 515 }
510#ifdef HAVE_REMOTE_LCD 516#ifdef HAVE_REMOTE_LCD
@@ -629,6 +635,9 @@ void button_init(void)
629#ifdef HAVE_LCD_BITMAP 635#ifdef HAVE_LCD_BITMAP
630 flipped = false; 636 flipped = false;
631#endif 637#endif
638#ifdef CONFIG_BACKLIGHT
639 filter_first_keypress = false;
640#endif
632} 641}
633 642
634#ifdef HAVE_LCD_BITMAP /* only bitmap displays can be flipped */ 643#ifdef HAVE_LCD_BITMAP /* only bitmap displays can be flipped */
@@ -687,6 +696,13 @@ void button_set_flip(bool flip)
687} 696}
688#endif /* HAVE_LCD_BITMAP */ 697#endif /* HAVE_LCD_BITMAP */
689 698
699#ifdef CONFIG_BACKLIGHT
700void set_backlight_filter_keypress(bool value)
701{
702 filter_first_keypress = value;
703}
704#endif
705
690/* 706/*
691 Archos hardware button hookup 707 Archos hardware button hookup
692 ============================= 708 =============================
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h
index e182803898..f371dc1423 100644
--- a/firmware/export/backlight.h
+++ b/firmware/export/backlight.h
@@ -21,6 +21,7 @@
21 21
22#include "config.h" 22#include "config.h"
23 23
24bool is_backlight_on(void);
24void backlight_on(void); 25void backlight_on(void);
25void backlight_off(void); 26void backlight_off(void);
26void backlight_set_timeout(int index); 27void backlight_set_timeout(int index);
diff --git a/firmware/export/button.h b/firmware/export/button.h
index 02d91d6a9b..a142540511 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -42,6 +42,9 @@ void button_clear_queue(void);
42#ifdef HAVE_LCD_BITMAP 42#ifdef HAVE_LCD_BITMAP
43void button_set_flip(bool flip); /* turn 180 degrees */ 43void button_set_flip(bool flip); /* turn 180 degrees */
44#endif 44#endif
45#ifdef CONFIG_BACKLIGHT
46void set_backlight_filter_keypress(bool value);
47#endif
45 48
46#ifdef HAS_BUTTON_HOLD 49#ifdef HAS_BUTTON_HOLD
47bool button_hold(void); 50bool button_hold(void);