summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Chicoine <mc2739@gmail.com>2009-11-21 21:16:08 +0000
committerMichael Chicoine <mc2739@gmail.com>2009-11-21 21:16:08 +0000
commitbbc8b1b8cb9b732e68fa5ae65199d8b33fb2911a (patch)
tree24ef4b0929ecb1b4478d87ee9eb11105fa988116
parent9dd6396aa2700697d2ff952079903fd230a1a0db (diff)
downloadrockbox-bbc8b1b8cb9b732e68fa5ae65199d8b33fb2911a.tar.gz
rockbox-bbc8b1b8cb9b732e68fa5ae65199d8b33fb2911a.zip
FS#10796 - Clip - prevent power switch activation when coming out of hold
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23686 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/sansa-clip/button-clip.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/firmware/target/arm/as3525/sansa-clip/button-clip.c b/firmware/target/arm/as3525/sansa-clip/button-clip.c
index 99a68a506d..53ebfa1295 100644
--- a/firmware/target/arm/as3525/sansa-clip/button-clip.c
+++ b/firmware/target/arm/as3525/sansa-clip/button-clip.c
@@ -20,6 +20,7 @@
20 * KIND, either express or implied. 20 * KIND, either express or implied.
21 * 21 *
22 ****************************************************************************/ 22 ****************************************************************************/
23#include "system.h"
23#include "button-target.h" 24#include "button-target.h"
24#include "as3525.h" 25#include "as3525.h"
25#ifndef BOOTLOADER 26#ifndef BOOTLOADER
@@ -56,12 +57,22 @@ int button_read_device(void)
56{ 57{
57 static int row = 0; 58 static int row = 0;
58 static int buttons = 0; 59 static int buttons = 0;
60 static unsigned power_counter = 0;
59 61
60 if(button_hold()) 62 if(button_hold())
63 {
64 power_counter = HZ;
61 return 0; 65 return 0;
66 }
62 67
63 /* direct GPIO connections */ 68 /* direct GPIO connections */
64 if (GPIOA_PIN(7)) 69 /* read power, but not if hold button was just released, since
70 * you basically always hit power due to the slider mechanism after
71 * releasing hold (wait 1 sec) */
72 if (power_counter)
73 power_counter--;
74
75 if (GPIOA_PIN(7) && !power_counter)
65 buttons |= BUTTON_POWER; 76 buttons |= BUTTON_POWER;
66 else 77 else
67 buttons &= ~BUTTON_POWER; 78 buttons &= ~BUTTON_POWER;