summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tcc77x/logikdax/button-logikdax.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tcc77x/logikdax/button-logikdax.c')
-rw-r--r--firmware/target/arm/tcc77x/logikdax/button-logikdax.c100
1 files changed, 0 insertions, 100 deletions
diff --git a/firmware/target/arm/tcc77x/logikdax/button-logikdax.c b/firmware/target/arm/tcc77x/logikdax/button-logikdax.c
deleted file mode 100644
index abf939753a..0000000000
--- a/firmware/target/arm/tcc77x/logikdax/button-logikdax.c
+++ /dev/null
@@ -1,100 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
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 "config.h"
23#include "cpu.h"
24#include "button.h"
25#include "adc.h"
26
27/*
28
29Results of button testing:
30
31HOLD: GPIOA & 0x0002 (0=pressed, 0x0002 = released)
32POWER: GPIOA & 0x8000 (0=pressed, 0x8000 = released)
33
34ADC[0]: (approx values)
35
36RIGHT - 0x37
37LEFT - 0x7f
38JOYSTICK PRESS - 0xc7
39UP - 0x11e
40DOWN - 0x184
41MODE - 0x1f0/0x1ff
42PRESET - 0x268/0x269
43REC - 0x2dd
44
45Values of ADC[0] tested in OF disassembly: 0x50, 0x96, 0xdc, 0x208, 0x384
46
47*/
48
49void button_init_device(void)
50{
51 /* Nothing to do */
52}
53
54int button_read_device(void)
55{
56 int btn = BUTTON_NONE;
57 int adc;
58
59 adc = adc_read(ADC_BUTTONS);
60
61 if (adc < 0x384) {
62 if (adc < 0x140) {
63 if (adc < 0x96) {
64 if (adc < 0x50) {
65 btn |= BUTTON_RIGHT; /* 0x00..0x4f */
66 } else {
67 btn |= BUTTON_LEFT; /* 0x50..0x95 */
68 }
69 } else {
70 if (adc < 0xe0) {
71 btn |= BUTTON_SELECT; /* 0x96..0xdf */
72 } else {
73 btn |= BUTTON_UP; /* 0xe0..0x13f */
74 }
75 }
76 } else {
77 if (adc < 0x208) {
78 if (adc < 0x1b0) {
79 btn |= BUTTON_DOWN; /* 0x140..0x1af */
80 } else {
81 btn |= BUTTON_MODE; /* 0x1b0..0x207 */
82 }
83 } else {
84 if (adc < 0x290) {
85 btn |= BUTTON_PRESET; /* 0x208..0x28f */
86 } else {
87 btn |= BUTTON_REC; /* 0x290..0x383 */
88 }
89 }
90 }
91 }
92
93 if (!(GPIOA & 0x2))
94 btn |= BUTTON_HOLD;
95
96 if (!(GPIOA & 0x8000))
97 btn |= BUTTON_POWERPLAY;
98
99 return btn;
100}