diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-04-01 16:07:56 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-04-01 16:07:56 +0000 |
commit | f376fd2f4aa9b27f2a6299177b4cc3c014da01f3 (patch) | |
tree | e42edd558e2deff42d3522189d92d158e861a307 /firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c | |
parent | 47dcf58e28930af8b468aa2151f1288e9ec334df (diff) | |
download | rockbox-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.c | 38 |
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 @@ | |||
24 | #include "button.h" | 24 | #include "button.h" |
25 | #include "backlight.h" | 25 | #include "backlight.h" |
26 | 26 | ||
27 | /* | 27 | extern void scrollwheel(unsigned wheel_value); |
28 | * TODO: Scrollwheel! | 28 | |
29 | */ | ||
30 | |||
31 | #ifdef HAS_BUTTON_HOLD | 29 | #ifdef HAS_BUTTON_HOLD |
32 | static bool hold_button = false; | 30 | static bool hold_button = false; |
33 | #endif | 31 | #endif |
34 | void button_init_device(void) | 32 | void button_init_device(void) |
33 | { /* activate the wheel */ | ||
34 | volatile int i; | ||
35 | GPIOB_DIR |= 1<<4; | ||
36 | for(i = 20; i; i--) nop; | ||
37 | GPIOB_PIN(4) = 0x10; | ||
38 | } | ||
39 | |||
40 | unsigned read_GPIOA_67(void) | ||
35 | { | 41 | { |
42 | unsigned ret = 0; | ||
43 | volatile int i; | ||
44 | DBOP_CTRL |= 1<<19; | ||
45 | for(i = 20; i; i--) nop; | ||
46 | GPIOA_DIR &= ~0xc0; | ||
47 | for(i = 20; i; i--) nop; | ||
48 | if (GPIOA_PIN(6) != 0) | ||
49 | ret = 1<<0; | ||
50 | for(i = 20; i; i--) nop; | ||
51 | if (GPIOA_PIN(7) != 0) | ||
52 | ret |= 1<<1; | ||
53 | DBOP_CTRL &= ~(1<<19); | ||
54 | for(i = 20; i; i--) nop; | ||
55 | return ret; | ||
56 | } | ||
57 | |||
58 | void get_scrollwheel(void) | ||
59 | { | ||
60 | #if defined(HAVE_SCROLLWHEEL) && !defined(BOOTLOADER) | ||
61 | /* scroll wheel handling */ | ||
62 | scrollwheel(read_GPIOA_67()); | ||
63 | #endif | ||
36 | } | 64 | } |
37 | 65 | ||
38 | /* | 66 | /* |
39 | * Get button pressed from hardware | 67 | * Get button pressed from hardware |
40 | */ | 68 | */ |
41 | 69 | ||
70 | |||
42 | int button_read_device(void) | 71 | int button_read_device(void) |
43 | { | 72 | { |
44 | int btn = 0; | 73 | int btn = 0; |
@@ -48,6 +77,7 @@ int button_read_device(void) | |||
48 | unsigned gpiod = GPIOD_DATA; | 77 | unsigned gpiod = GPIOD_DATA; |
49 | unsigned gpioa_dir = GPIOA_DIR; | 78 | unsigned gpioa_dir = GPIOA_DIR; |
50 | unsigned gpiod6; | 79 | unsigned gpiod6; |
80 | get_scrollwheel(); | ||
51 | for(delay = 500; delay; delay--) nop; | 81 | for(delay = 500; delay; delay--) nop; |
52 | CCU_IO &= ~(1<<12); | 82 | CCU_IO &= ~(1<<12); |
53 | for(delay=8;delay;delay--) nop; | 83 | for(delay=8;delay;delay--) nop; |