diff options
-rw-r--r-- | firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c index b9139ef555..d50df9f1c6 100644 --- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c +++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c | |||
@@ -38,29 +38,15 @@ void button_init_device(void) | |||
38 | GPIOB_PIN(4) = 1<<4; /* activate the wheel */ | 38 | GPIOB_PIN(4) = 1<<4; /* activate the wheel */ |
39 | } | 39 | } |
40 | 40 | ||
41 | unsigned read_GPIOA_67(void) | ||
42 | { | ||
43 | unsigned ret = 0; | ||
44 | volatile int i; | ||
45 | DBOP_CTRL |= 1<<19; | ||
46 | for(i = 20; i; i--) nop; | ||
47 | GPIOA_DIR &= ~0xc0; | ||
48 | for(i = 20; i; i--) nop; | ||
49 | if (GPIOA_PIN(6) != 0) | ||
50 | ret = 1<<0; | ||
51 | for(i = 20; i; i--) nop; | ||
52 | if (GPIOA_PIN(7) != 0) | ||
53 | ret |= 1<<1; | ||
54 | DBOP_CTRL &= ~(1<<19); | ||
55 | for(i = 20; i; i--) nop; | ||
56 | return ret; | ||
57 | } | ||
58 | |||
59 | void get_scrollwheel(void) | 41 | void get_scrollwheel(void) |
60 | { | 42 | { |
61 | #if defined(HAVE_SCROLLWHEEL) && !defined(BOOTLOADER) | 43 | #if defined(HAVE_SCROLLWHEEL) && !defined(BOOTLOADER) |
62 | /* scroll wheel handling */ | 44 | /* scroll wheel handling */ |
63 | scrollwheel(read_GPIOA_67()); | 45 | |
46 | #define GPIOA_PIN76_offset ((1<<(6+2)) | (1<<(7+2))) | ||
47 | #define GPIOA_PIN76 (*(volatile unsigned char*)(GPIOA_BASE+GPIOA_PIN76_offset)) | ||
48 | scrollwheel(GPIOA_PIN76 >> 6); | ||
49 | |||
64 | #endif | 50 | #endif |
65 | } | 51 | } |
66 | 52 | ||
@@ -77,6 +63,11 @@ int button_read_device(void) | |||
77 | static long power_counter = 0; | 63 | static long power_counter = 0; |
78 | unsigned gpiod6; | 64 | unsigned gpiod6; |
79 | 65 | ||
66 | /* if we remove this delay, we see screen corruption (the higher the CPU | ||
67 | * frequency the higher the corruption) */ | ||
68 | for(delay = 1000; delay; delay--) | ||
69 | nop; | ||
70 | |||
80 | get_scrollwheel(); | 71 | get_scrollwheel(); |
81 | 72 | ||
82 | CCU_IO &= ~(1<<12); | 73 | CCU_IO &= ~(1<<12); |