summaryrefslogtreecommitdiff
path: root/firmware/target/arm/olympus/mrobe-500/button-target.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/olympus/mrobe-500/button-target.h')
-rw-r--r--firmware/target/arm/olympus/mrobe-500/button-target.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/firmware/target/arm/olympus/mrobe-500/button-target.h b/firmware/target/arm/olympus/mrobe-500/button-target.h
new file mode 100644
index 0000000000..6637c5bf2b
--- /dev/null
+++ b/firmware/target/arm/olympus/mrobe-500/button-target.h
@@ -0,0 +1,99 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: $
9 *
10 * Copyright (C) 2007 by Karl Kurbjun
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#ifndef _BUTTON_TARGET_H_
21#define _BUTTON_TARGET_H_
22
23#include <stdbool.h>
24#include "config.h"
25
26#define HAS_BUTTON_HOLD
27
28bool button_hold(void);
29void button_init_device(void);
30int button_read_device(void);
31
32/* Toshiba Gigabeat specific button codes */
33
34#define BUTTON_POWER 0x00000001
35#define BUTTON_MENU 0x00000002
36
37#define BUTTON_LEFT 0x00000004
38#define BUTTON_RIGHT 0x00000008
39#define BUTTON_UP 0x00000010
40#define BUTTON_DOWN 0x00000020
41
42#define BUTTON_VOL_UP 0x00000040
43#define BUTTON_VOL_DOWN 0x00000080
44
45#define BUTTON_SELECT 0x00000100
46#define BUTTON_A 0x00000200
47
48/* Remote control buttons */
49
50#define BUTTON_RC_VOL_UP 0x00000400
51#define BUTTON_RC_VOL_DOWN 0x00000800
52#define BUTTON_RC_FF 0x00001000
53#define BUTTON_RC_REW 0x00002000
54
55#define BUTTON_RC_PLAY 0x00004000
56#define BUTTON_RC_DSP 0x00008000
57
58/* Toshiba Gigabeat specific remote button ADC values */
59/* The remote control uses ADC 1 to emulate button pushes
60 Reading (approx) Button HP plugged in? Remote plugged in?
61 0 N/A Yes No
62 125 Play/Pause Cant tell Yes
63 241 Speaker+ Cant tell Yes
64 369 Rewind Cant tell Yes
65 492 Fast Fwd Cant tell Yes
66 616 Vol + Cant tell Yes
67 742 Vol - Cant tell Yes
68 864 None Cant tell Yes
69 1023 N/A No No
70*/
71
72/*
73 Notes:
74
75 Buttons on the remote are translated into equivalent button presses just
76 as if you were pressing them on the Gigabeat itself.
77
78 We cannot tell if the hold is asserted on the remote. The Hold function on
79 the remote is to block the output of the buttons changing.
80
81 Only one button can be sensed at a time. If another is pressed, the button
82 with the lowest reading is dominant. So, if Rewind and Vol + are pressed
83 at the same time, Rewind value is the one that is read.
84*/
85
86
87
88
89#define BUTTON_MAIN (BUTTON_POWER|BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT\
90 |BUTTON_UP|BUTTON_DOWN|BUTTON_VOL_UP|BUTTON_VOL_DOWN\
91 |BUTTON_SELECT|BUTTON_A)
92
93#define BUTTON_REMOTE (BUTTON_RC_VOL_UP|BUTTON_RC_VOL_DOWN|BUTTON_RC_FF\
94 |BUTTON_RC_REW|BUTTON_RC_PLAY|BUTTON_RC_DSP)
95
96#define POWEROFF_BUTTON BUTTON_POWER
97#define POWEROFF_COUNT 10
98
99#endif /* _BUTTON_TARGET_H_ */