summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/as3525/sansa-clipplus/button-clip.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/firmware/target/arm/as3525/sansa-clipplus/button-clip.c b/firmware/target/arm/as3525/sansa-clipplus/button-clip.c
index 60b8c8f7a3..09d62562ee 100644
--- a/firmware/target/arm/as3525/sansa-clipplus/button-clip.c
+++ b/firmware/target/arm/as3525/sansa-clipplus/button-clip.c
@@ -29,7 +29,7 @@ void button_init_device(void)
29 GPIOC_DIR = 0; /* All C pins input */ 29 GPIOC_DIR = 0; /* All C pins input */
30 GPIOA_DIR &= ~(1<<1|1<<6|1<<7); /* Pins A1,A6,A7 input */ 30 GPIOA_DIR &= ~(1<<1|1<<6|1<<7); /* Pins A1,A6,A7 input */
31 /* OF does not set D6 to input */ 31 /* OF does not set D6 to input */
32 GPIOB_DIR |= (1<<6); /* Pin B6 output */ 32 GPIOB_DIR |= (1<<6); /* Pin B6 output */
33 GPIOB_DIR |= (1<<0); /* Pin B0 set output */ 33 GPIOB_DIR |= (1<<0); /* Pin B0 set output */
34} 34}
35 35
@@ -38,24 +38,25 @@ int button_read_device(void)
38 int buttons = 0; 38 int buttons = 0;
39 39
40 /* Buttons do not appear to need reset */ 40 /* Buttons do not appear to need reset */
41 /* D6 needs special handling though */ 41 /* D6 does not appear to need special handling */
42 42#if 0
43 GPIOB_PIN(0) = 1; /* set B0 */ 43 GPIOB_PIN(0) = 1; /* set B0 */
44 44
45 int delay = 500; 45 int delay = 500;
46 do { 46 do {
47 asm volatile("nop\n"); 47 asm volatile("nop\n");
48 } while (delay--); 48 } while (delay--);
49 49#endif
50 if GPIOD_PIN(6) /* read D6 */ 50 if GPIOD_PIN(6) /* read D6 */
51 buttons |= BUTTON_POWER; 51 buttons |= BUTTON_POWER;
52 52#if 0
53 GPIOB_PIN(0) = 0; /* unset B0 */ 53 GPIOB_PIN(0) = 0; /* unset B0 */
54 54
55 delay = 240; 55 delay = 240;
56 do { 56 do {
57 asm volatile("nop\n"); 57 asm volatile("nop\n");
58 } while (delay--); 58 } while (delay--);
59#endif
59 60
60 if GPIOA_PIN(1) 61 if GPIOA_PIN(1)
61 buttons |= BUTTON_HOME; 62 buttons |= BUTTON_HOME;
@@ -63,6 +64,9 @@ int button_read_device(void)
63 buttons |= BUTTON_VOL_DOWN; 64 buttons |= BUTTON_VOL_DOWN;
64 if GPIOA_PIN(7) 65 if GPIOA_PIN(7)
65 buttons |= BUTTON_VOL_UP; 66 buttons |= BUTTON_VOL_UP;
67
68 if GPIOC_PIN(1)
69 buttons |= BUTTON_DOWN;
66 if GPIOC_PIN(2) 70 if GPIOC_PIN(2)
67 buttons |= BUTTON_UP; 71 buttons |= BUTTON_UP;
68 if GPIOC_PIN(3) 72 if GPIOC_PIN(3)
@@ -71,8 +75,6 @@ int button_read_device(void)
71 buttons |= BUTTON_SELECT; 75 buttons |= BUTTON_SELECT;
72 if GPIOC_PIN(5) 76 if GPIOC_PIN(5)
73 buttons |= BUTTON_RIGHT; 77 buttons |= BUTTON_RIGHT;
74 if GPIOC_PIN(1)
75 buttons |= BUTTON_DOWN;
76 78
77 return buttons; 79 return buttons;
78} 80}