diff options
Diffstat (limited to 'firmware/button.c')
-rw-r--r-- | firmware/button.c | 50 |
1 files changed, 45 insertions, 5 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 | |||
161 | void button_init(void) | ||
162 | { | ||
163 | /* set port pins as input */ | ||
164 | PAIOR &= ~0x820; | ||
165 | } | ||
166 | |||
167 | int 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: |