summaryrefslogtreecommitdiff
path: root/firmware/drivers/button.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/button.c')
-rw-r--r--firmware/drivers/button.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 544cfec32e..0c17fce4c6 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -61,7 +61,7 @@ static bool flipped; /* buttons can be flipped to match the LCD flip */
61#define REPEAT_INTERVAL_FINISH 5 61#define REPEAT_INTERVAL_FINISH 5
62 62
63/* the power-off button and number of repeated keys before shutting off */ 63/* the power-off button and number of repeated keys before shutting off */
64#if CONFIG_KEYPAD == IPOD_4G_PAD 64#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD)
65#define POWEROFF_BUTTON BUTTON_PLAY 65#define POWEROFF_BUTTON BUTTON_PLAY
66#define POWEROFF_COUNT 40 66#define POWEROFF_COUNT 40
67#else 67#else
@@ -731,6 +731,47 @@ static int button_read(void)
731 if (!remote_hold_button && ((data & 0x40) == 0)) 731 if (!remote_hold_button && ((data & 0x40) == 0))
732 btn |= BUTTON_RC_ON; 732 btn |= BUTTON_RC_ON;
733 733
734#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
735
736 static bool hold_button = false;
737
738 /* light handling */
739 if (hold_button && !button_hold())
740 {
741 backlight_on();
742 }
743 hold_button = button_hold();
744
745 /* normal buttons */
746 if (!button_hold())
747 {
748 data = adc_read(ADC_BUTTONS);
749
750 if (data < 0x151)
751 if (data < 0xc7)
752 if (data < 0x41)
753 btn = BUTTON_LEFT;
754 else
755 btn = BUTTON_RIGHT;
756 else
757 btn = BUTTON_SELECT;
758 else
759 if (data < 0x268)
760 if (data < 0x1d7)
761 btn = BUTTON_UP;
762 else
763 btn = BUTTON_DOWN;
764 else
765 if (data < 0x2f9)
766 btn = BUTTON_EQ;
767 else
768 if (data < 0x35c)
769 btn = BUTTON_MODE;
770 }
771
772 if (!button_hold() && (adc_read(ADC_BUTTON_PLAY) < 0x64))
773 btn |= BUTTON_PLAY;
774
734#elif CONFIG_KEYPAD == RECORDER_PAD 775#elif CONFIG_KEYPAD == RECORDER_PAD
735 776
736#ifdef HAVE_FMADC 777#ifdef HAVE_FMADC
@@ -877,6 +918,13 @@ bool remote_button_hold(void)
877} 918}
878#endif 919#endif
879 920
921#if CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
922bool button_hold(void)
923{
924 return (GPIO5_READ & 4) ? false : true;
925}
926#endif
927
880int button_status(void) 928int button_status(void)
881{ 929{
882 return lastbtn; 930 return lastbtn;