Added player button scanning
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@154 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e7246de933
commit
8c1d94fb23
2 changed files with 64 additions and 17 deletions
|
@ -21,13 +21,11 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_RECORDER_KEYPAD
|
||||
|
||||
#include "types.h"
|
||||
#include "sh7034.h"
|
||||
#include "button.h"
|
||||
|
||||
#ifdef HAVE_RECORDER_KEYPAD
|
||||
|
||||
/* AJBR buttons are connected to the CPU as follows:
|
||||
*
|
||||
* ON and OFF are connected to separate port B input pins.
|
||||
|
@ -148,7 +146,49 @@ int button_get(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#endif /* HAVE_RECORDER_KEYPAD */
|
||||
#elif HAVE_PLAYER_KEYPAD
|
||||
|
||||
/* The player has all buttons on port pins:
|
||||
|
||||
LEFT: PC0
|
||||
RIGHT: PC2
|
||||
PLAY: PC3
|
||||
STOP: PA11
|
||||
ON: PA5
|
||||
MENU: PC1
|
||||
*/
|
||||
|
||||
void button_init(void)
|
||||
{
|
||||
/* set port pins as input */
|
||||
PAIOR &= ~0x820;
|
||||
}
|
||||
|
||||
int button_get(void)
|
||||
{
|
||||
int porta = PADR;
|
||||
int portc = PCDR;
|
||||
int btn = 0;
|
||||
|
||||
if ( portc & 1 )
|
||||
btn |= BUTTON_LEFT;
|
||||
if ( portc & 2 )
|
||||
btn |= BUTTON_MENU;
|
||||
if ( portc & 4 )
|
||||
btn |= BUTTON_RIGHT;
|
||||
if ( portc & 8 )
|
||||
btn |= BUTTON_PLAY | BUTTON_UP;
|
||||
if ( porta & 0x20 )
|
||||
btn |= BUTTON_ON;
|
||||
if ( porta & 0x800 )
|
||||
btn |= BUTTON_STOP | BUTTON_DOWN;
|
||||
|
||||
return btn;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------
|
||||
* local variables:
|
||||
|
|
|
@ -19,29 +19,36 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_RECORDER_KEYPAD
|
||||
/*
|
||||
* Archos Jukebox Recorder button functions
|
||||
*/
|
||||
void button_init (void);
|
||||
int button_get (void);
|
||||
|
||||
/* Button codes */
|
||||
/* Shared button codes */
|
||||
#define BUTTON_NONE 0x0000
|
||||
#define BUTTON_ON 0x0001
|
||||
#define BUTTON_OFF 0x0002
|
||||
#define BUTTON_PLAY 0x0004
|
||||
#define BUTTON_UP 0x0010
|
||||
#define BUTTON_DOWN 0x0020
|
||||
#define BUTTON_LEFT 0x0040
|
||||
#define BUTTON_RIGHT 0x0080
|
||||
#define BUTTON_F1 0x0100
|
||||
#define BUTTON_F2 0x0200
|
||||
#define BUTTON_F3 0x0400
|
||||
|
||||
/* Button modifiers */
|
||||
#define BUTTON_HELD 0x4000
|
||||
#define BUTTON_REL 0x8000
|
||||
|
||||
void button_init (void);
|
||||
int button_get (void);
|
||||
|
||||
#ifdef HAVE_RECORDER_KEYPAD
|
||||
|
||||
/* Recorder specific button codes */
|
||||
#define BUTTON_OFF 0x0002
|
||||
#define BUTTON_PLAY 0x0004
|
||||
#define BUTTON_F1 0x0100
|
||||
#define BUTTON_F2 0x0200
|
||||
#define BUTTON_F3 0x0400
|
||||
|
||||
#elif HAVE_PLAYER_KEYPAD
|
||||
|
||||
/* Jukebox 6000 and Studio specific button codes */
|
||||
#define BUTTON_MENU 0x0002
|
||||
#define BUTTON_PLAY BUTTON_UP
|
||||
#define BUTTON_STOP BUTTON_DOWN
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue