summaryrefslogtreecommitdiff
path: root/firmware/target/arm/philips/sa9200/button-sa9200.c
diff options
context:
space:
mode:
authorMark Arigo <markarigo@gmail.com>2008-05-21 03:55:17 +0000
committerMark Arigo <markarigo@gmail.com>2008-05-21 03:55:17 +0000
commitb4275d4941e464c851ae3f5fe33c80f56ea365e5 (patch)
tree6f82b4e9cc490bf759dc4e1c64b4416d3b2d4879 /firmware/target/arm/philips/sa9200/button-sa9200.c
parent4c99f9a74964c4a44ca27a216f302bdc79b23121 (diff)
downloadrockbox-b4275d4941e464c851ae3f5fe33c80f56ea365e5.tar.gz
rockbox-b4275d4941e464c851ae3f5fe33c80f56ea365e5.zip
Philips GoGear SA9200 port. Working bootloader and normal builds, including sound. No touchpad now, buttons limited to using vol+/vol-/power for up/down/select. Rockbox USB is enabled since the OF is MTP only...read the warnings on the PortalPlayerUsb wiki page.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17591 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/philips/sa9200/button-sa9200.c')
-rwxr-xr-xfirmware/target/arm/philips/sa9200/button-sa9200.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/firmware/target/arm/philips/sa9200/button-sa9200.c b/firmware/target/arm/philips/sa9200/button-sa9200.c
new file mode 100755
index 0000000000..dc9f3466c2
--- /dev/null
+++ b/firmware/target/arm/philips/sa9200/button-sa9200.c
@@ -0,0 +1,72 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Mark Arigo
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "system.h"
21#include "button.h"
22#include "backlight.h"
23
24void button_init_device(void)
25{
26 /* TODO...for now, hardware initialisation is done by the c200 bootloader */
27}
28
29bool button_hold(void)
30{
31 return !(GPIOL_INPUT_VAL & 0x40);
32}
33
34/*
35 * Get button pressed from hardware
36 */
37int button_read_device(void)
38{
39 int btn = BUTTON_NONE;
40 static bool hold_button = false;
41 bool hold_button_old;
42
43 /* Hold */
44 hold_button_old = hold_button;
45 hold_button = button_hold();
46
47#ifndef BOOTLOADER
48 if (hold_button != hold_button_old)
49 backlight_hold_changed(hold_button);
50#endif
51
52 /* device buttons */
53 if (!hold_button)
54 {
55#if 0
56 if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER;
57 if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP;
58 if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN;
59#endif
60 /* A hack until the touchpad works */
61 if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_SELECT;
62 if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_UP;
63 if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_DOWN;
64 }
65
66 return btn;
67}
68
69bool headphones_inserted(void)
70{
71 return (GPIOB_INPUT_VAL & 0x10) ? false : true;
72}