diff options
Diffstat (limited to 'firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c')
-rw-r--r-- | firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c index 4907de11f3..30f2c0df16 100644 --- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c +++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c | |||
@@ -213,9 +213,9 @@ void button_gpioa_isr(void) | |||
213 | */ | 213 | */ |
214 | int button_read_device(void) | 214 | int button_read_device(void) |
215 | { | 215 | { |
216 | int btn = 0; | ||
217 | static long power_counter = 0; | 216 | static long power_counter = 0; |
218 | bool hold = false; | 217 | bool hold = false; |
218 | int btn; | ||
219 | unsigned gpiod6; | 219 | unsigned gpiod6; |
220 | 220 | ||
221 | /* if we don't wait for the fifo to empty, we'll see screen corruption | 221 | /* if we don't wait for the fifo to empty, we'll see screen corruption |
@@ -240,28 +240,16 @@ int button_read_device(void) | |||
240 | GPIOB_PIN(0) = 0; | 240 | GPIOB_PIN(0) = 0; |
241 | udelay(2); | 241 | udelay(2); |
242 | 242 | ||
243 | if (GPIOC_PIN(1) & 1<<1) | 243 | btn = GPIOC_PIN_MASK(0x3e) | (GPIOB_PIN(1) >> 1); |
244 | btn |= BUTTON_DOWN; | 244 | |
245 | if (GPIOC_PIN(2) & 1<<2) | ||
246 | btn |= BUTTON_UP; | ||
247 | if (GPIOC_PIN(3) & 1<<3) | ||
248 | btn |= BUTTON_LEFT; | ||
249 | if (GPIOC_PIN(4) & 1<<4) | ||
250 | btn |= BUTTON_SELECT; | ||
251 | if (GPIOC_PIN(5) & 1<<5) | ||
252 | btn |= BUTTON_RIGHT; | ||
253 | if (GPIOB_PIN(1) & 1<<1) | ||
254 | btn |= BUTTON_HOME; | ||
255 | if (amsv2_variant == 1) | 245 | if (amsv2_variant == 1) |
256 | btn ^= BUTTON_HOME; | 246 | btn ^= BUTTON_HOME; |
257 | 247 | ||
258 | if (gpiod6 & 1<<6) | 248 | if (gpiod6) |
259 | { /* power/hold is on the same pin. we know it's hold if the bit isn't | 249 | { /* power/hold is on the same pin. we know it's hold if the bit isn't |
260 | * set now anymore */ | 250 | * set now anymore */ |
261 | if (GPIOD_PIN(6) & 1<<6) | 251 | btn |= GPIOD_PIN(6); |
262 | btn |= BUTTON_POWER; | 252 | hold = !(btn & BUTTON_POWER); |
263 | else | ||
264 | hold = true; | ||
265 | } | 253 | } |
266 | 254 | ||
267 | if(gpiob_pin0_dir) | 255 | if(gpiob_pin0_dir) |