summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c')
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c93
1 files changed, 0 insertions, 93 deletions
diff --git a/firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c
deleted file mode 100644
index abf31b4feb..0000000000
--- a/firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 Vitja Makarov
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#include "config.h"
22#include "cpu.h"
23#include "button.h"
24#include "backlight.h"
25#include "adc.h"
26
27#include "button-target.h"
28#include "ata2501.h"
29
30void button_init_device(void)
31{
32 ata2501_init();
33}
34
35/*
36 touchpad:
37 0: stop
38 1-8: between next & prev
39 9: play
40 10: next
41 11: prev
42*/
43
44int button_read_device(void)
45{
46 static bool hold_button = false;
47 bool hold_button_old;
48
49 int btn = BUTTON_NONE;
50 int adc;
51 int sensor;
52
53 hold_button_old = hold_button;
54 hold_button = button_hold();
55
56#ifndef BOOTLOADER
57 if (hold_button != hold_button_old)
58 backlight_hold_changed(hold_button);
59#endif
60
61 if (button_hold())
62 return BUTTON_NONE;
63
64 adc = adc_read(0);
65 sensor = ata2501_read();
66
67 if (0 == (GPIOA & 4))
68 btn |= BUTTON_POWER;
69
70 /* seems they can't be hold together */
71 if (adc < 0x120)
72 btn |= BUTTON_VOLUP;
73 else if (adc < 0x270)
74 btn |= BUTTON_VOLDOWN;
75 else if (adc < 0x300)
76 btn |= BUTTON_MENU;
77
78 if (sensor & (1 << 0))
79 btn |= BUTTON_STOP;
80 if (sensor & (1 << 9))
81 btn |= BUTTON_PLAY;
82 if (sensor & ((1 << 10) | 0x1c0))
83 btn |= BUTTON_RIGHT;
84 if (sensor & ((1 << 11) | 0xe))
85 btn |= BUTTON_LEFT;
86
87 return btn;
88}
89
90bool button_hold(void)
91{
92 return !(GPIOA & 0x2);
93}