summaryrefslogtreecommitdiff
path: root/firmware/drivers/button.c
diff options
context:
space:
mode:
authorHristo Kovachev <bger@rockbox.org>2006-03-25 19:16:45 +0000
committerHristo Kovachev <bger@rockbox.org>2006-03-25 19:16:45 +0000
commita70c6b9b1e2bcf7a5a207017d6c40f5254f6ef98 (patch)
treee39563c6b848d65c0700875676c01da43d3f645b /firmware/drivers/button.c
parent7b9ab84e7d37a761a7b4a5817c6da71213cc17ad (diff)
downloadrockbox-a70c6b9b1e2bcf7a5a207017d6c40f5254f6ef98.tar.gz
rockbox-a70c6b9b1e2bcf7a5a207017d6c40f5254f6ef98.zip
Patch #4913 by David Rothenberger with some changes by me: add only backlight on first keypress to the lcd remotes, too.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9253 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/button.c')
-rw-r--r--firmware/drivers/button.c69
1 files changed, 65 insertions, 4 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 9e649ead5a..6855feb1a8 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -40,8 +40,7 @@
40#include "system.h" 40#include "system.h"
41#include "powermgmt.h" 41#include "powermgmt.h"
42 42
43#if (CONFIG_KEYPAD == IRIVER_H100_PAD) \ 43#ifdef HAVE_REMOTE_LCD
44 || (CONFIG_KEYPAD == IRIVER_H300_PAD)
45#include "lcd-remote.h" 44#include "lcd-remote.h"
46#endif 45#endif
47 46
@@ -54,6 +53,9 @@ static bool flipped; /* buttons can be flipped to match the LCD flip */
54#endif 53#endif
55#ifdef CONFIG_BACKLIGHT 54#ifdef CONFIG_BACKLIGHT
56static bool filter_first_keypress; 55static bool filter_first_keypress;
56#ifdef HAVE_REMOTE_LCD
57static bool remote_filter_first_keypress;
58#endif
57#endif 59#endif
58 60
59/* how often we check to see if a button is pressed */ 61/* how often we check to see if a button is pressed */
@@ -403,6 +405,12 @@ static void button_tick(void)
403 static int repeat_count = 0; 405 static int repeat_count = 0;
404 static bool repeat = false; 406 static bool repeat = false;
405 static bool post = false; 407 static bool post = false;
408#ifdef CONFIG_BACKLIGHT
409 static bool skip_release = false;
410#ifdef HAVE_REMOTE_LCD
411 static bool skip_remote_release = false;
412#endif
413#endif
406 int diff; 414 int diff;
407 int btn; 415 int btn;
408 416
@@ -425,7 +433,22 @@ static void button_tick(void)
425 diff = btn ^ lastbtn; 433 diff = btn ^ lastbtn;
426 if(diff && (btn & diff) == 0) 434 if(diff && (btn & diff) == 0)
427 { 435 {
436#ifdef CONFIG_BACKLIGHT
437#ifdef HAVE_REMOTE_LCD
438 if(diff & BUTTON_REMOTE)
439 if(!skip_remote_release)
440 queue_post(&button_queue, BUTTON_REL | diff, NULL);
441 else
442 skip_remote_release = false;
443 else
444#endif
445 if(!skip_release)
446 queue_post(&button_queue, BUTTON_REL | diff, NULL);
447 else
448 skip_release = false;
449#else
428 queue_post(&button_queue, BUTTON_REL | diff, NULL); 450 queue_post(&button_queue, BUTTON_REL | diff, NULL);
451#endif
429 } 452 }
430 else 453 else
431 { 454 {
@@ -502,15 +525,44 @@ static void button_tick(void)
502 { 525 {
503 queue_post( 526 queue_post(
504 &button_queue, BUTTON_REPEAT | btn, NULL); 527 &button_queue, BUTTON_REPEAT | btn, NULL);
528#ifdef CONFIG_BACKLIGHT
529#ifdef HAVE_REMOTE_LCD
530 if(btn & BUTTON_REMOTE)
531 {
532 if(skip_remote_release)
533 skip_remote_release = false;
534 }
535 else
536#endif
537 if(skip_release)
538 skip_release = false;
539#endif
505 post = false; 540 post = false;
506 } 541 }
507 } 542 }
508 else 543 else
509 { 544 {
510#ifdef CONFIG_BACKLIGHT 545#ifdef CONFIG_BACKLIGHT
511 if ( !filter_first_keypress || is_backlight_on()) 546#ifdef HAVE_REMOTE_LCD
547 if (btn & BUTTON_REMOTE) {
548 if (!remote_filter_first_keypress || is_remote_backlight_on()
549#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
550 ||(remote_type()==REMOTETYPE_H300_NONLCD)
551#endif
552 )
553 queue_post(&button_queue, btn, NULL);
554 else
555 skip_remote_release = true;
556 }
557 else
558#endif
559 if (!filter_first_keypress || is_backlight_on())
560 queue_post(&button_queue, btn, NULL);
561 else
562 skip_release = true;
563#else /* no backlight, nothing to skip */
564 queue_post(&button_queue, btn, NULL);
512#endif 565#endif
513 queue_post(&button_queue, btn, NULL);
514 post = false; 566 post = false;
515 } 567 }
516#ifdef HAVE_REMOTE_LCD 568#ifdef HAVE_REMOTE_LCD
@@ -637,6 +689,9 @@ void button_init(void)
637#endif 689#endif
638#ifdef CONFIG_BACKLIGHT 690#ifdef CONFIG_BACKLIGHT
639 filter_first_keypress = false; 691 filter_first_keypress = false;
692#ifdef HAVE_REMOTE_LCD
693 remote_filter_first_keypress = false;
694#endif
640#endif 695#endif
641} 696}
642 697
@@ -701,6 +756,12 @@ void set_backlight_filter_keypress(bool value)
701{ 756{
702 filter_first_keypress = value; 757 filter_first_keypress = value;
703} 758}
759#ifdef HAVE_REMOTE_LCD
760void set_remote_backlight_filter_keypress(bool value)
761{
762 remote_filter_first_keypress = value;
763}
764#endif
704#endif 765#endif
705 766
706/* 767/*