summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
index fc2715216c..fb2eba208c 100644
--- a/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
+++ b/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
@@ -70,10 +70,54 @@ void clickwheel_int(void)
70/* device buttons */ 70/* device buttons */
71void button_int(void) 71void button_int(void)
72{ 72{
73 unsigned char state; 73 int dir_save_b = 0;
74 int afsel_save_b = 0;
75 int dir_save_c = 0;
76 int afsel_save_c = 0;
74 77
75 int_btn = BUTTON_NONE; 78 int_btn = BUTTON_NONE;
76 79
80 /* Save the current direction and afsel */
81 dir_save_b = GPIOB_DIR;
82 afsel_save_b = GPIOB_AFSEL;
83 dir_save_c = GPIOC_DIR;
84 afsel_save_c = GPIOC_AFSEL;
85
86 GPIOB_DIR = 0;
87 GPIOB_AFSEL = 0;
88 GPIOC_DIR = 0;
89 GPIOC_AFSEL = 0;
90
91 /* These should not be needed with button event interupts */
92 /* they are necessary now to clear out lcd data */
93 GPIOC_PIN(0) |= 1;
94 GPIOC_PIN(1) |= 1;
95 GPIOC_PIN(2) |= 1;
96 GPIOC_PIN(3) |= 1;
97 GPIOC_PIN(4) |= 1;
98 GPIOC_PIN(5) |= 1;
99 GPIOC_PIN(6) |= 1;
100 GPIOC_PIN(7) |= 1;
101
102 /* direct GPIO connections */
103 if (GPIOB_PIN(4))
104 int_btn |= BUTTON_POWER;
105 if (!GPIOC_PIN(6))
106 int_btn |= BUTTON_DOWN;
107 if (!GPIOC_PIN(5))
108 int_btn |= BUTTON_RIGHT;
109 if (!GPIOC_PIN(4))
110 int_btn |= BUTTON_SELECT;
111 if (!GPIOC_PIN(3))
112 int_btn |= BUTTON_LEFT;
113 if (!GPIOC_PIN(2))
114 int_btn |= BUTTON_UP;
115
116 /* return to settings needed for lcd */
117 GPIOB_DIR = dir_save_b;
118 GPIOB_AFSEL = afsel_save_b;
119 GPIOC_DIR = dir_save_c;
120 GPIOC_AFSEL = afsel_save_c;
77} 121}
78 122
79/* 123/*