From 6a568761c88622321b29e338acdb5b52eff6ae3e Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sat, 9 Dec 2017 22:36:58 +0100 Subject: CLIPPLUS -- Remove un-needed handling for power button button button_read_device() switching GPIOB in order to read GPIOD96) (power button) is apparently unneeded Change-Id: I1fbf13f67f938806086754cdd5e389ef6746ae5f --- firmware/target/arm/as3525/sansa-clipplus/button-clip.c | 16 +++++++++------- 1 file 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) GPIOC_DIR = 0; /* All C pins input */ GPIOA_DIR &= ~(1<<1|1<<6|1<<7); /* Pins A1,A6,A7 input */ /* OF does not set D6 to input */ - GPIOB_DIR |= (1<<6); /* Pin B6 output */ + GPIOB_DIR |= (1<<6); /* Pin B6 output */ GPIOB_DIR |= (1<<0); /* Pin B0 set output */ } @@ -38,24 +38,25 @@ int button_read_device(void) int buttons = 0; /* Buttons do not appear to need reset */ - /* D6 needs special handling though */ - + /* D6 does not appear to need special handling */ +#if 0 GPIOB_PIN(0) = 1; /* set B0 */ int delay = 500; do { asm volatile("nop\n"); } while (delay--); - +#endif if GPIOD_PIN(6) /* read D6 */ buttons |= BUTTON_POWER; - +#if 0 GPIOB_PIN(0) = 0; /* unset B0 */ delay = 240; do { asm volatile("nop\n"); } while (delay--); +#endif if GPIOA_PIN(1) buttons |= BUTTON_HOME; @@ -63,6 +64,9 @@ int button_read_device(void) buttons |= BUTTON_VOL_DOWN; if GPIOA_PIN(7) buttons |= BUTTON_VOL_UP; + + if GPIOC_PIN(1) + buttons |= BUTTON_DOWN; if GPIOC_PIN(2) buttons |= BUTTON_UP; if GPIOC_PIN(3) @@ -71,8 +75,6 @@ int button_read_device(void) buttons |= BUTTON_SELECT; if GPIOC_PIN(5) buttons |= BUTTON_RIGHT; - if GPIOC_PIN(1) - buttons |= BUTTON_DOWN; return buttons; } -- cgit v1.2.3