summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx233/sansa-fuzeplus
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2011-05-04 18:00:22 +0000
committerAmaury Pouly <pamaury@rockbox.org>2011-05-04 18:00:22 +0000
commitffee0b5e94e565f94b7a312bcbee12d932b6e332 (patch)
tree11bcea325aba3ff18613db58ddf8f3831cfd878e /firmware/target/arm/imx233/sansa-fuzeplus
parent37a9a200b2ab93f02b8085e78aac91b8ff68419c (diff)
downloadrockbox-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')
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c19
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/button-target.h1
2 files changed, 18 insertions, 2 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
23void button_init_device(void) 26void button_init_device(void)
24{ 27{
@@ -26,5 +29,19 @@ void button_init_device(void)
26 29
27int button_read_device(void) 30int 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}
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h b/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h
index b5d27bb176..81bbc34511 100644
--- a/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h
+++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h
@@ -29,7 +29,6 @@ int button_read_device(void);
29 29
30/* Main unit's buttons */ 30/* Main unit's buttons */
31#define BUTTON_POWER 0x00000001 31#define BUTTON_POWER 0x00000001
32
33#define BUTTON_VOL_UP 0x00000002 32#define BUTTON_VOL_UP 0x00000002
34#define BUTTON_VOL_DOWN 0x00000004 33#define BUTTON_VOL_DOWN 0x00000004
35 34