diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-07-15 19:40:55 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-07-24 21:20:13 +0000 |
commit | 092c340a2062fa98b7387fc5fd63578ddae7d0b6 (patch) | |
tree | 98ec96946eeb2ae709cb0528cc6998e21bb9b290 /firmware/target/sh/archos/recorder/button-recorder.c | |
parent | 17f7cc92c258bc456a27c3e7c5a19c9409851879 (diff) | |
download | rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.tar.gz rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.zip |
[1/4] Remove SH support and all archos targets
This removes all code specific to SH targets
Change-Id: I7980523785d2596e65c06430f4638eec74a06061
Diffstat (limited to 'firmware/target/sh/archos/recorder/button-recorder.c')
-rw-r--r-- | firmware/target/sh/archos/recorder/button-recorder.c | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/firmware/target/sh/archos/recorder/button-recorder.c b/firmware/target/sh/archos/recorder/button-recorder.c deleted file mode 100644 index 5e5e67487d..0000000000 --- a/firmware/target/sh/archos/recorder/button-recorder.c +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Jens Arnold | ||
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 "system.h" | ||
24 | #include "button.h" | ||
25 | #include "backlight.h" | ||
26 | #include "adc.h" | ||
27 | |||
28 | /* | ||
29 | Recorder hardware button hookup | ||
30 | =============================== | ||
31 | |||
32 | F1, F2, F3, UP: connected to AN4 through a resistor network | ||
33 | DOWN, PLAY, LEFT, RIGHT: likewise connected to AN5 | ||
34 | |||
35 | The voltage on AN4/ AN5 depends on which keys (or key combo) is pressed | ||
36 | |||
37 | ON: PB8, low active | ||
38 | OFF: PB4, low active | ||
39 | */ | ||
40 | |||
41 | void button_init_device(void) | ||
42 | { | ||
43 | /* Set PB4 and PB8 as input pins */ | ||
44 | PBCR1 &= 0xfffc; /* PB8MD = 00 */ | ||
45 | PBCR2 &= 0xfcff; /* PB4MD = 00 */ | ||
46 | PBIOR &= ~0x0110; /* Inputs */ | ||
47 | } | ||
48 | |||
49 | int button_read_device(void) | ||
50 | { | ||
51 | int btn = BUTTON_NONE; | ||
52 | int data; | ||
53 | static int off_button_count = 0; | ||
54 | |||
55 | /* check F1..F3 and UP */ | ||
56 | data = adc_read(ADC_BUTTON_ROW1); | ||
57 | if (data >= 250) | ||
58 | { | ||
59 | if (data >= 700) | ||
60 | if (data >= 900) | ||
61 | btn = BUTTON_F3; | ||
62 | else | ||
63 | btn = BUTTON_UP; | ||
64 | else | ||
65 | if (data >= 500) | ||
66 | btn = BUTTON_F2; | ||
67 | else | ||
68 | btn = BUTTON_F1; | ||
69 | } | ||
70 | |||
71 | /* Some units have mushy keypads, so pressing UP also activates | ||
72 | the Left/Right buttons. Let's combat that by skipping the AN5 | ||
73 | checks when UP is pressed. */ | ||
74 | if(!(btn & BUTTON_UP)) | ||
75 | { | ||
76 | /* check DOWN, PLAY, LEFT, RIGHT */ | ||
77 | data = adc_read(ADC_BUTTON_ROW2); | ||
78 | if (data >= 250) | ||
79 | { | ||
80 | if (data >= 700) | ||
81 | if (data >= 900) | ||
82 | btn |= BUTTON_DOWN; | ||
83 | else | ||
84 | btn |= BUTTON_PLAY; | ||
85 | else | ||
86 | if (data >= 500) | ||
87 | btn |= BUTTON_LEFT; | ||
88 | else | ||
89 | btn |= BUTTON_RIGHT; | ||
90 | } | ||
91 | } | ||
92 | |||
93 | /* check port B pins for ON and OFF */ | ||
94 | data = PBDR; | ||
95 | if ((data & 0x0100) == 0) | ||
96 | btn |= BUTTON_ON; | ||
97 | |||
98 | if ((data & 0x0010) == 0) | ||
99 | { | ||
100 | /* When the batteries are low, the low-battery shutdown logic causes | ||
101 | * spurious OFF events due to voltage fluctuation on some units. | ||
102 | * Only accept OFF when read several times in sequence. */ | ||
103 | if (++off_button_count > 3) | ||
104 | btn |= BUTTON_OFF; | ||
105 | } | ||
106 | else | ||
107 | off_button_count = 0; | ||
108 | |||
109 | return btn; | ||
110 | } | ||