summaryrefslogtreecommitdiff
path: root/firmware/target/arm/samsung/button-yh82x_yh92x.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/samsung/button-yh82x_yh92x.c')
-rw-r--r--firmware/target/arm/samsung/button-yh82x_yh92x.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/firmware/target/arm/samsung/button-yh82x_yh92x.c b/firmware/target/arm/samsung/button-yh82x_yh92x.c
new file mode 100644
index 0000000000..1ed8089b90
--- /dev/null
+++ b/firmware/target/arm/samsung/button-yh82x_yh92x.c
@@ -0,0 +1,72 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Mark Arigo
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "system.h"
23#include "button.h"
24#include "backlight.h"
25
26void button_init_device(void)
27{
28 /* TODO...for now, hardware initialisation is done by the OF bootloader */
29}
30
31bool button_hold(void)
32{
33 return (~GPIOA_INPUT_VAL & 0x1);
34}
35
36/*
37 * Get button pressed from hardware
38 */
39int button_read_device(void)
40{
41 int btn = BUTTON_NONE;
42 static bool hold_button = false;
43 bool hold_button_old;
44
45 /* Hold */
46 hold_button_old = hold_button;
47 hold_button = button_hold();
48
49#ifndef BOOTLOADER
50 if (hold_button != hold_button_old)
51 backlight_hold_changed(hold_button);
52#endif
53
54 /* device buttons */
55 if (!hold_button)
56 {
57 if (~GPIOA_INPUT_VAL & 0x04) btn |= BUTTON_LEFT;
58 if (~GPIOA_INPUT_VAL & 0x20) btn |= BUTTON_RIGHT;
59 if (~GPIOA_INPUT_VAL & 0x10) btn |= BUTTON_UP;
60 if (~GPIOA_INPUT_VAL & 0x08) btn |= BUTTON_DOWN;
61 if (~GPIOA_INPUT_VAL & 0x02) btn |= BUTTON_FFWD;
62 if (~GPIOA_INPUT_VAL & 0x80) btn |= BUTTON_REW;
63 if (~GPIOA_INPUT_VAL & 0x40) btn |= BUTTON_REC;
64#if defined(SAMSUNG_YH820)
65 if ( GPIOB_INPUT_VAL & 0x80) btn |= BUTTON_PLAY;
66#elif defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)
67 if ( GPIOD_INPUT_VAL & 0x04) btn |= BUTTON_PLAY;
68#endif
69 }
70
71 return btn;
72}