summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;