summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-04-01 16:07:56 +0000
committerThomas Martitz <kugel@rockbox.org>2010-04-01 16:07:56 +0000
commitf376fd2f4aa9b27f2a6299177b4cc3c014da01f3 (patch)
treee42edd558e2deff42d3522189d92d158e861a307 /firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
parent47dcf58e28930af8b468aa2151f1288e9ec334df (diff)
downloadrockbox-f376fd2f4aa9b27f2a6299177b4cc3c014da01f3.tar.gz
rockbox-f376fd2f4aa9b27f2a6299177b4cc3c014da01f3.zip
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
Diffstat (limited to 'firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c')
-rw-r--r--firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
index 0a6d2c919c..4848d9e7d9 100644
--- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
+++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
@@ -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;