diff options
author | Amaury Pouly <pamaury@rockbox.org> | 2011-05-04 18:00:22 +0000 |
---|---|---|
committer | Amaury Pouly <pamaury@rockbox.org> | 2011-05-04 18:00:22 +0000 |
commit | ffee0b5e94e565f94b7a312bcbee12d932b6e332 (patch) | |
tree | 11bcea325aba3ff18613db58ddf8f3831cfd878e /firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c | |
parent | 37a9a200b2ab93f02b8085e78aac91b8ff68419c (diff) | |
download | rockbox-ffee0b5e94e565f94b7a312bcbee12d932b6e332.tar.gz rockbox-ffee0b5e94e565f94b7a312bcbee12d932b6e332.zip |
fuze+: move defines from .c to .h; implement button reading for volume up/down and power
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29822 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c')
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c index 7f37d67d43..4882f243aa 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c | |||
@@ -19,6 +19,9 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "button-target.h" | 21 | #include "button-target.h" |
22 | #include "system.h" | ||
23 | #include "system-target.h" | ||
24 | #include "pinctrl-imx233.h" | ||
22 | 25 | ||
23 | void button_init_device(void) | 26 | void button_init_device(void) |
24 | { | 27 | { |
@@ -26,5 +29,19 @@ void button_init_device(void) | |||
26 | 29 | ||
27 | int button_read_device(void) | 30 | int button_read_device(void) |
28 | { | 31 | { |
29 | return 0; | 32 | int res = 0; |
33 | if(!imx233_get_gpio_input_mask(1, 0x40000000)) | ||
34 | res |= BUTTON_VOL_DOWN; | ||
35 | /* The imx233 uses the voltage on the PSWITCH pin to detect power up/down | ||
36 | * events as well as recovery mode. Since the power button is the power button | ||
37 | * and the volume up button is recovery, it is not possible to know whether | ||
38 | * power button is down when volume up is down (except if there is another | ||
39 | * method but volume up and power don't seem to be wired to GPIO pins). */ | ||
40 | switch((HW_POWER_STS & HW_POWER_STS__PSWITCH_BM) >> HW_POWER_STS__PSWITCH_BP) | ||
41 | { | ||
42 | case 1: res |= BUTTON_POWER; break; | ||
43 | case 3: res |= BUTTON_VOL_UP; break; | ||
44 | default: break; | ||
45 | } | ||
46 | return res; | ||
30 | } | 47 | } |