mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
Fuzev2: Scrollwheel works like a charm :)
Move scrollwheel parsing function into separate file as it's reused. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25425 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
47dcf58e28
commit
f376fd2f4a
9 changed files with 187 additions and 115 deletions
|
|
@ -24,21 +24,50 @@
|
|||
#include "button.h"
|
||||
#include "backlight.h"
|
||||
|
||||
/*
|
||||
* TODO: Scrollwheel!
|
||||
*/
|
||||
|
||||
extern void scrollwheel(unsigned wheel_value);
|
||||
|
||||
#ifdef HAS_BUTTON_HOLD
|
||||
static bool hold_button = false;
|
||||
#endif
|
||||
void button_init_device(void)
|
||||
{ /* activate the wheel */
|
||||
volatile int i;
|
||||
GPIOB_DIR |= 1<<4;
|
||||
for(i = 20; i; i--) nop;
|
||||
GPIOB_PIN(4) = 0x10;
|
||||
}
|
||||
|
||||
unsigned read_GPIOA_67(void)
|
||||
{
|
||||
unsigned ret = 0;
|
||||
volatile int i;
|
||||
DBOP_CTRL |= 1<<19;
|
||||
for(i = 20; i; i--) nop;
|
||||
GPIOA_DIR &= ~0xc0;
|
||||
for(i = 20; i; i--) nop;
|
||||
if (GPIOA_PIN(6) != 0)
|
||||
ret = 1<<0;
|
||||
for(i = 20; i; i--) nop;
|
||||
if (GPIOA_PIN(7) != 0)
|
||||
ret |= 1<<1;
|
||||
DBOP_CTRL &= ~(1<<19);
|
||||
for(i = 20; i; i--) nop;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void get_scrollwheel(void)
|
||||
{
|
||||
#if defined(HAVE_SCROLLWHEEL) && !defined(BOOTLOADER)
|
||||
/* scroll wheel handling */
|
||||
scrollwheel(read_GPIOA_67());
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Get button pressed from hardware
|
||||
*/
|
||||
|
||||
|
||||
int button_read_device(void)
|
||||
{
|
||||
int btn = 0;
|
||||
|
|
@ -48,6 +77,7 @@ int button_read_device(void)
|
|||
unsigned gpiod = GPIOD_DATA;
|
||||
unsigned gpioa_dir = GPIOA_DIR;
|
||||
unsigned gpiod6;
|
||||
get_scrollwheel();
|
||||
for(delay = 500; delay; delay--) nop;
|
||||
CCU_IO &= ~(1<<12);
|
||||
for(delay=8;delay;delay--) nop;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@ void button_init_device(void);
|
|||
bool button_hold(void);
|
||||
int button_read_device(void);
|
||||
unsigned short button_read_dbop(void);
|
||||
void get_scrollwheel(void);
|
||||
|
||||
#define WHEEL_REPEAT_INTERVAL (HZ/5)
|
||||
#define WHEEL_COUNTER_DIV 4
|
||||
#define ACCEL_INCREMENT 2
|
||||
#define ACCEL_SHIFT 2
|
||||
/* Sandisk Sansa Fuze button codes */
|
||||
|
||||
/* Main unit's buttons */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue