Fix include problem
[kugel-rb.git] / firmware / target / arm / samsung / button-yh82x_yh92x.c
blob1ed8089b9055387784b88bf06bf20fc0b3dce2e0
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2009 by Mark Arigo
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include "system.h"
23 #include "button.h"
24 #include "backlight.h"
26 void button_init_device(void)
28 /* TODO...for now, hardware initialisation is done by the OF bootloader */
31 bool button_hold(void)
33 return (~GPIOA_INPUT_VAL & 0x1);
37 * Get button pressed from hardware
39 int button_read_device(void)
41 int btn = BUTTON_NONE;
42 static bool hold_button = false;
43 bool hold_button_old;
45 /* Hold */
46 hold_button_old = hold_button;
47 hold_button = button_hold();
49 #ifndef BOOTLOADER
50 if (hold_button != hold_button_old)
51 backlight_hold_changed(hold_button);
52 #endif
54 /* device buttons */
55 if (!hold_button)
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
71 return btn;