summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-11-01 23:38:57 +0000
committerDave Chapman <dave@dchapman.com>2007-11-01 23:38:57 +0000
commita4d48d0c0dabb3e78e6b1dc31c023627ce924ce1 (patch)
tree23210360f876d7c962368a85f81c909824e2a7e1 /firmware/target
parent80e4d671d2271c8a6a3ec463c277fcf7b3fa3ab9 (diff)
downloadrockbox-a4d48d0c0dabb3e78e6b1dc31c023627ce924ce1.tar.gz
rockbox-a4d48d0c0dabb3e78e6b1dc31c023627ce924ce1.zip
Button driver for Logik DAX, plus some changes to the debug info displayed in the bootloader build.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15396 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/tcc77x/logikdax/button-logikdax.c98
-rw-r--r--firmware/target/arm/tcc77x/logikdax/button-target.h27
2 files changed, 102 insertions, 23 deletions
diff --git a/firmware/target/arm/tcc77x/logikdax/button-logikdax.c b/firmware/target/arm/tcc77x/logikdax/button-logikdax.c
new file mode 100644
index 0000000000..8e4279b699
--- /dev/null
+++ b/firmware/target/arm/tcc77x/logikdax/button-logikdax.c
@@ -0,0 +1,98 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
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 "config.h"
21#include "cpu.h"
22#include "button.h"
23#include "adc.h"
24
25/*
26
27Results of button testing:
28
29HOLD: GPIOA & 0x0002 (0=pressed, 0x0002 = released)
30POWER: GPIOA & 0x8000 (0=pressed, 0x8000 = released)
31
32ADC[0]: (approx values)
33
34RIGHT - 0x37
35LEFT - 0x7f
36JOYSTICK PRESS - 0xc7
37UP - 0x11e
38DOWN - 0x184
39MODE - 0x1f0/0x1ff
40PRESET - 0x268/0x269
41REC - 0x2dd
42
43Values of ADC[0] tested in OF disassembly: 0x50, 0x96, 0xdc, 0x208, 0x384
44
45*/
46
47void button_init_device(void)
48{
49 /* Nothing to do */
50}
51
52int button_read_device(void)
53{
54 int btn = BUTTON_NONE;
55 int adc;
56
57 adc = adc_read(ADC_BUTTONS);
58
59 if (adc < 0x384) {
60 if (adc < 0x140) {
61 if (adc < 0x96) {
62 if (adc < 0x50) {
63 btn |= BUTTON_RIGHT; /* 0x00..0x4f */
64 } else {
65 btn |= BUTTON_LEFT; /* 0x50..0x95 */
66 }
67 } else {
68 if (adc < 0xe0) {
69 btn |= BUTTON_SELECT; /* 0x96..0xdf */
70 } else {
71 btn |= BUTTON_UP; /* 0xe0..0x13f */
72 }
73 }
74 } else {
75 if (adc < 0x208) {
76 if (adc < 0x1b0) {
77 btn |= BUTTON_DOWN; /* 0x140..0x1af */
78 } else {
79 btn |= BUTTON_MODE; /* 0x1b0..0x207 */
80 }
81 } else {
82 if (adc < 0x290) {
83 btn |= BUTTON_PRESET; /* 0x208..0x28f */
84 } else {
85 btn |= BUTTON_REC; /* 0x290..0x383 */
86 }
87 }
88 }
89 }
90
91 if (!(GPIOA & 0x2))
92 btn |= BUTTON_HOLD;
93
94 if (!(GPIOA & 0x8000))
95 btn |= BUTTON_POWERPLAY;
96
97 return btn;
98}
diff --git a/firmware/target/arm/tcc77x/logikdax/button-target.h b/firmware/target/arm/tcc77x/logikdax/button-target.h
index 2925a423b6..46997fc5d0 100644
--- a/firmware/target/arm/tcc77x/logikdax/button-target.h
+++ b/firmware/target/arm/tcc77x/logikdax/button-target.h
@@ -23,29 +23,6 @@
23#include <stdbool.h> 23#include <stdbool.h>
24#include "config.h" 24#include "config.h"
25 25
26/*
27
28Results of button testing:
29
30HOLD: GPIOA & 0x0002 (0=pressed, 0x0002 = released)
31POWER: GPIOA & 0x8000 (0=pressed, 0x8000 = released)
32
33ADC[0]: (approx values)
34
35RIGHT - 0x37
36LEFT - 0x7f
37JOYSTICK PRESS - 0xc7
38UP - 0x11e
39DOWN - 0x184
40MODE - 0x1f0/0x1ff
41PRESET - 0x268/0x269
42TIMESHIFT - 0x2dd
43
44Values of ADC[0] tested in OF disassembly: 0x50, 0x96, 0xdc, 0x208, 0x384
45
46*/
47
48
49void button_init_device(void); 26void button_init_device(void);
50int button_read_device(void); 27int button_read_device(void);
51 28
@@ -66,5 +43,9 @@ int button_read_device(void);
66 |BUTTON_RIGHT|BUTTON_UP|BUTTON_DOWN|BUTTON_SELECT) 43 |BUTTON_RIGHT|BUTTON_UP|BUTTON_DOWN|BUTTON_SELECT)
67 44
68#define BUTTON_REMOTE 0 45#define BUTTON_REMOTE 0
46
47/* Software power-off */
48#define POWEROFF_BUTTON BUTTON_POWERPLAY
49#define POWEROFF_COUNT 40
69 50
70#endif /* _BUTTON_TARGET_H_ */ 51#endif /* _BUTTON_TARGET_H_ */