mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
Fuze v2: Do button reading more efficiently by mapping button codes directly to the GPIO pin states where possible (all but 'home' and hold). This makes plugins incompatible; up the min version and sort things.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29097 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5f52f6ee01
commit
2da0f9bcfd
4 changed files with 27 additions and 34 deletions
|
|
@ -213,9 +213,9 @@ void button_gpioa_isr(void)
|
|||
*/
|
||||
int button_read_device(void)
|
||||
{
|
||||
int btn = 0;
|
||||
static long power_counter = 0;
|
||||
bool hold = false;
|
||||
int btn;
|
||||
unsigned gpiod6;
|
||||
|
||||
/* if we don't wait for the fifo to empty, we'll see screen corruption
|
||||
|
|
@ -240,28 +240,16 @@ int button_read_device(void)
|
|||
GPIOB_PIN(0) = 0;
|
||||
udelay(2);
|
||||
|
||||
if (GPIOC_PIN(1) & 1<<1)
|
||||
btn |= BUTTON_DOWN;
|
||||
if (GPIOC_PIN(2) & 1<<2)
|
||||
btn |= BUTTON_UP;
|
||||
if (GPIOC_PIN(3) & 1<<3)
|
||||
btn |= BUTTON_LEFT;
|
||||
if (GPIOC_PIN(4) & 1<<4)
|
||||
btn |= BUTTON_SELECT;
|
||||
if (GPIOC_PIN(5) & 1<<5)
|
||||
btn |= BUTTON_RIGHT;
|
||||
if (GPIOB_PIN(1) & 1<<1)
|
||||
btn |= BUTTON_HOME;
|
||||
btn = GPIOC_PIN_MASK(0x3e) | (GPIOB_PIN(1) >> 1);
|
||||
|
||||
if (amsv2_variant == 1)
|
||||
btn ^= BUTTON_HOME;
|
||||
|
||||
if (gpiod6 & 1<<6)
|
||||
if (gpiod6)
|
||||
{ /* power/hold is on the same pin. we know it's hold if the bit isn't
|
||||
* set now anymore */
|
||||
if (GPIOD_PIN(6) & 1<<6)
|
||||
btn |= BUTTON_POWER;
|
||||
else
|
||||
hold = true;
|
||||
btn |= GPIOD_PIN(6);
|
||||
hold = !(btn & BUTTON_POWER);
|
||||
}
|
||||
|
||||
if(gpiob_pin0_dir)
|
||||
|
|
|
|||
|
|
@ -32,15 +32,14 @@ bool button_hold(void);
|
|||
int button_read_device(void);
|
||||
/* Sandisk Sansa Fuze button codes */
|
||||
|
||||
/* Main unit's buttons */
|
||||
/* Main unit's buttons - mapped for optimal reading */
|
||||
#define BUTTON_HOME 0x00000001
|
||||
|
||||
#define BUTTON_DOWN 0x00000002
|
||||
#define BUTTON_RIGHT 0x00000004
|
||||
|
||||
#define BUTTON_UP 0x00000004
|
||||
#define BUTTON_LEFT 0x00000008
|
||||
#define BUTTON_SELECT 0x00000010
|
||||
#define BUTTON_UP 0x00000020
|
||||
#define BUTTON_RIGHT 0x00000020
|
||||
|
||||
#define BUTTON_POWER 0x00000040
|
||||
|
||||
#define BUTTON_SCROLL_BACK 0x00000080
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue