summaryrefslogtreecommitdiff
path: root/firmware/target/arm/philips/hdd1630/button-hdd1630.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/philips/hdd1630/button-hdd1630.c')
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/button-hdd1630.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/firmware/target/arm/philips/hdd1630/button-hdd1630.c b/firmware/target/arm/philips/hdd1630/button-hdd1630.c
new file mode 100755
index 0000000000..ac478065bc
--- /dev/null
+++ b/firmware/target/arm/philips/hdd1630/button-hdd1630.c
@@ -0,0 +1,65 @@
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 bootloader */
27}
28
29bool button_hold(void)
30{
31 return !(GPIOJ_INPUT_VAL & 0x8);
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 /* device buttons */
48 if (!hold_button)
49 {
50 if (!(GPIOA_INPUT_VAL & 0x01)) btn |= BUTTON_MENU;
51 if (!(GPIOA_INPUT_VAL & 0x02)) btn |= BUTTON_VOL_UP;
52 if (!(GPIOA_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN;
53 if (!(GPIOA_INPUT_VAL & 0x08)) btn |= BUTTON_VIEW;
54
55 if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST;
56 if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER;
57 }
58
59 return btn;
60}
61
62bool headphones_inserted(void)
63{
64 return true;
65}