diff options
author | Hristo Kovachev <bger@rockbox.org> | 2006-03-25 19:16:45 +0000 |
---|---|---|
committer | Hristo Kovachev <bger@rockbox.org> | 2006-03-25 19:16:45 +0000 |
commit | a70c6b9b1e2bcf7a5a207017d6c40f5254f6ef98 (patch) | |
tree | e39563c6b848d65c0700875676c01da43d3f645b /firmware | |
parent | 7b9ab84e7d37a761a7b4a5817c6da71213cc17ad (diff) | |
download | rockbox-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')
-rw-r--r-- | firmware/backlight.c | 27 | ||||
-rw-r--r-- | firmware/drivers/button.c | 69 | ||||
-rw-r--r-- | firmware/export/backlight.h | 1 | ||||
-rw-r--r-- | firmware/export/button.h | 3 |
4 files changed, 96 insertions, 4 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c index a205511157..1d9e4b54c4 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c | |||
@@ -597,6 +597,32 @@ void remote_backlight_set_timeout_plugged(int index) | |||
597 | remote_backlight_on(); | 597 | remote_backlight_on(); |
598 | } | 598 | } |
599 | #endif | 599 | #endif |
600 | |||
601 | /* return value in ticks; 0 means always on, <0 means always off */ | ||
602 | int remote_backlight_get_current_timeout(void) | ||
603 | { | ||
604 | #ifdef HAVE_CHARGING | ||
605 | if (charger_inserted() | ||
606 | #ifdef HAVE_USB_POWER | ||
607 | || usb_powered() | ||
608 | #endif | ||
609 | ) | ||
610 | return remote_backlight_timeout_plugged; | ||
611 | else | ||
612 | return remote_backlight_timeout; | ||
613 | #else | ||
614 | return remote_backlight_timeout; | ||
615 | #endif | ||
616 | } | ||
617 | |||
618 | bool is_remote_backlight_on(void) | ||
619 | { | ||
620 | if (remote_backlight_timer != 0 || !remote_backlight_get_current_timeout()) | ||
621 | return true; | ||
622 | else | ||
623 | return false; | ||
624 | } | ||
625 | |||
600 | #endif /* HAVE_REMOTE_LCD */ | 626 | #endif /* HAVE_REMOTE_LCD */ |
601 | 627 | ||
602 | #else /* no backlight, empty dummy functions */ | 628 | #else /* no backlight, empty dummy functions */ |
@@ -620,6 +646,7 @@ bool is_backlight_on(void) {return true;} | |||
620 | void remote_backlight_on(void) {} | 646 | void remote_backlight_on(void) {} |
621 | void remote_backlight_off(void) {} | 647 | void remote_backlight_off(void) {} |
622 | void remote_backlight_set_timeout(int index) {(void)index;} | 648 | void remote_backlight_set_timeout(int index) {(void)index;} |
649 | bool is_remote_backlight_on(void) {return true;} | ||
623 | #endif | 650 | #endif |
624 | #endif /* #ifdef CONFIG_BACKLIGHT */ | 651 | #endif /* #ifdef CONFIG_BACKLIGHT */ |
625 | 652 | ||
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 |
56 | static bool filter_first_keypress; | 55 | static bool filter_first_keypress; |
56 | #ifdef HAVE_REMOTE_LCD | ||
57 | static 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 | ||
760 | void 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 | /* |
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h index f371dc1423..508d472381 100644 --- a/firmware/export/backlight.h +++ b/firmware/export/backlight.h | |||
@@ -43,6 +43,7 @@ void remote_backlight_on(void); | |||
43 | void remote_backlight_off(void); | 43 | void remote_backlight_off(void); |
44 | void remote_backlight_set_timeout(int index); | 44 | void remote_backlight_set_timeout(int index); |
45 | void remote_backlight_set_timeout_plugged(int index); | 45 | void remote_backlight_set_timeout_plugged(int index); |
46 | bool is_remote_backlight_on(void); | ||
46 | #endif | 47 | #endif |
47 | 48 | ||
48 | #ifdef SIMULATOR | 49 | #ifdef SIMULATOR |
diff --git a/firmware/export/button.h b/firmware/export/button.h index a142540511..2290b284ce 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h | |||
@@ -44,6 +44,9 @@ void button_set_flip(bool flip); /* turn 180 degrees */ | |||
44 | #endif | 44 | #endif |
45 | #ifdef CONFIG_BACKLIGHT | 45 | #ifdef CONFIG_BACKLIGHT |
46 | void set_backlight_filter_keypress(bool value); | 46 | void set_backlight_filter_keypress(bool value); |
47 | #ifdef HAVE_REMOTE_LCD | ||
48 | void set_remote_backlight_filter_keypress(bool value); | ||
49 | #endif | ||
47 | #endif | 50 | #endif |
48 | 51 | ||
49 | #ifdef HAS_BUTTON_HOLD | 52 | #ifdef HAS_BUTTON_HOLD |