summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c')
-rw-r--r--firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
index d50df9f1c6..db08414ae5 100644
--- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
+++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
@@ -58,29 +58,26 @@ void get_scrollwheel(void)
58int button_read_device(void) 58int button_read_device(void)
59{ 59{
60 int btn = 0; 60 int btn = 0;
61 volatile int delay;
62 static bool hold_button_old = false; 61 static bool hold_button_old = false;
63 static long power_counter = 0; 62 static long power_counter = 0;
64 unsigned gpiod6; 63 unsigned gpiod6;
65 64
66 /* if we remove this delay, we see screen corruption (the higher the CPU 65
67 * frequency the higher the corruption) */ 66 /* if we don't wait for the fifo to empty, we'll see screen corruption
68 for(delay = 1000; delay; delay--) 67 * (the higher the CPU frequency the higher the corruption) */
69 nop; 68 while ((DBOP_STAT & (1<<10)) == 0);
70 69
71 get_scrollwheel(); 70 get_scrollwheel();
72 71
73 CCU_IO &= ~(1<<12); 72 CCU_IO &= ~(1<<12);
74 73
75 GPIOB_PIN(0) = 1<<0; 74 GPIOB_PIN(0) = 1<<0;
76 for(delay = 500; delay; delay--) 75 udelay(1);
77 nop;
78 76
79 gpiod6 = GPIOD_PIN(6); 77 gpiod6 = GPIOD_PIN(6);
80 78
81 GPIOB_PIN(0) = 0; 79 GPIOB_PIN(0) = 0;
82 for(delay = 240; delay; delay--) 80 udelay(1);
83 nop;
84 81
85 if (GPIOC_PIN(1) & 1<<1) 82 if (GPIOC_PIN(1) & 1<<1)
86 btn |= BUTTON_DOWN; 83 btn |= BUTTON_DOWN;