summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tcc77x/m200/button-m200.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tcc77x/m200/button-m200.c')
-rw-r--r--firmware/target/arm/tcc77x/m200/button-m200.c99
1 files changed, 0 insertions, 99 deletions
diff --git a/firmware/target/arm/tcc77x/m200/button-m200.c b/firmware/target/arm/tcc77x/m200/button-m200.c
deleted file mode 100644
index a37fe1302c..0000000000
--- a/firmware/target/arm/tcc77x/m200/button-m200.c
+++ /dev/null
@@ -1,99 +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 (viewing ADC values whilst pressing buttons):
30
31HOLD: GPIOB & 0x0200 (0=hold active, 0x0200 = hold inactive)
32
33ADC[1]: (approx values)
34
35Idle - 0x3ff
36MENU - unknown
37
38REPEAT/AB - 0x03?
39LEFT - 0x07?-0x08?
40SELECT - 0x0c?
41RIGHT - 0x11?
42
43PLAY/PAUSE - 0x17?-0x018?
44VOL UP - 0x1e?-0x01f?
45VOL DOWN - 0x26?
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 /* TODO - determine how to detect BUTTON_MENU - it doesn't appear to
60 be connected to a GPIO or to an ADC
61 */
62
63 adc = adc_read(ADC_BUTTONS);
64
65 if (adc < 0x384) {
66 if (adc < 0x140) {
67 if (adc < 0x96) {
68 if (adc < 0x50) {
69 btn |= BUTTON_REPEATAB; /* 0x00..0x4f */
70 } else {
71 btn |= BUTTON_LEFT; /* 0x50..0x95 */
72 }
73 } else {
74 if (adc < 0xe0) {
75 btn |= BUTTON_SELECT; /* 0x96..0xdf */
76 } else {
77 btn |= BUTTON_RIGHT; /* 0xe0..0x13f */
78 }
79 }
80 } else {
81 if (adc < 0x208) {
82 if (adc < 0x1b0) {
83 btn |= BUTTON_PLAYPAUSE; /* 0x140..0x1af */
84 } else {
85 btn |= BUTTON_VOLUP; /* 0x1b0..0x207 */
86 }
87 } else {
88 btn |= BUTTON_VOLDOWN; /* 0x209..0x383 */
89 }
90 }
91 }
92
93 return btn;
94}
95
96bool button_hold(void)
97{
98 return (GPIOB & 0x200)?false:true;
99}