summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/button.c50
-rw-r--r--firmware/button.h31
2 files changed, 64 insertions, 17 deletions
diff --git a/firmware/button.c b/firmware/button.c
index bedd294606..a1abccd32a 100644
--- a/firmware/button.c
+++ b/firmware/button.c
@@ -21,13 +21,11 @@
21 */ 21 */
22 22
23#include "config.h" 23#include "config.h"
24
25#ifdef HAVE_RECORDER_KEYPAD
26
27#include "types.h"
28#include "sh7034.h" 24#include "sh7034.h"
29#include "button.h" 25#include "button.h"
30 26
27#ifdef HAVE_RECORDER_KEYPAD
28
31/* AJBR buttons are connected to the CPU as follows: 29/* AJBR buttons are connected to the CPU as follows:
32 * 30 *
33 * ON and OFF are connected to separate port B input pins. 31 * ON and OFF are connected to separate port B input pins.
@@ -148,7 +146,49 @@ int button_get(void)
148 return ret; 146 return ret;
149} 147}
150 148
151#endif /* HAVE_RECORDER_KEYPAD */ 149#elif HAVE_PLAYER_KEYPAD
150
151/* The player has all buttons on port pins:
152
153 LEFT: PC0
154 RIGHT: PC2
155 PLAY: PC3
156 STOP: PA11
157 ON: PA5
158 MENU: PC1
159*/
160
161void button_init(void)
162{
163 /* set port pins as input */
164 PAIOR &= ~0x820;
165}
166
167int button_get(void)
168{
169 int porta = PADR;
170 int portc = PCDR;
171 int btn = 0;
172
173 if ( portc & 1 )
174 btn |= BUTTON_LEFT;
175 if ( portc & 2 )
176 btn |= BUTTON_MENU;
177 if ( portc & 4 )
178 btn |= BUTTON_RIGHT;
179 if ( portc & 8 )
180 btn |= BUTTON_PLAY | BUTTON_UP;
181 if ( porta & 0x20 )
182 btn |= BUTTON_ON;
183 if ( porta & 0x800 )
184 btn |= BUTTON_STOP | BUTTON_DOWN;
185
186 return btn;
187}
188
189#endif
190
191
152 192
153/* ----------------------------------------------------------------- 193/* -----------------------------------------------------------------
154 * local variables: 194 * local variables:
diff --git a/firmware/button.h b/firmware/button.h
index a09c7a25dc..a8cc71b875 100644
--- a/firmware/button.h
+++ b/firmware/button.h
@@ -19,29 +19,36 @@
19 19
20#include "config.h" 20#include "config.h"
21 21
22#ifdef HAVE_RECORDER_KEYPAD 22void button_init (void);
23/* 23int button_get (void);
24 * Archos Jukebox Recorder button functions
25 */
26 24
27/* Button codes */ 25/* Shared button codes */
28#define BUTTON_NONE 0x0000 26#define BUTTON_NONE 0x0000
29#define BUTTON_ON 0x0001 27#define BUTTON_ON 0x0001
30#define BUTTON_OFF 0x0002
31#define BUTTON_PLAY 0x0004
32#define BUTTON_UP 0x0010 28#define BUTTON_UP 0x0010
33#define BUTTON_DOWN 0x0020 29#define BUTTON_DOWN 0x0020
34#define BUTTON_LEFT 0x0040 30#define BUTTON_LEFT 0x0040
35#define BUTTON_RIGHT 0x0080 31#define BUTTON_RIGHT 0x0080
36#define BUTTON_F1 0x0100
37#define BUTTON_F2 0x0200
38#define BUTTON_F3 0x0400
39 32
40/* Button modifiers */ 33/* Button modifiers */
41#define BUTTON_HELD 0x4000 34#define BUTTON_HELD 0x4000
42#define BUTTON_REL 0x8000 35#define BUTTON_REL 0x8000
43 36
44void button_init (void); 37
45int button_get (void); 38#ifdef HAVE_RECORDER_KEYPAD
39
40/* Recorder specific button codes */
41#define BUTTON_OFF 0x0002
42#define BUTTON_PLAY 0x0004
43#define BUTTON_F1 0x0100
44#define BUTTON_F2 0x0200
45#define BUTTON_F3 0x0400
46
47#elif HAVE_PLAYER_KEYPAD
48
49/* Jukebox 6000 and Studio specific button codes */
50#define BUTTON_MENU 0x0002
51#define BUTTON_PLAY BUTTON_UP
52#define BUTTON_STOP BUTTON_DOWN
46 53
47#endif 54#endif