diff options
Diffstat (limited to 'firmware/target/arm/as3525/sansa-clip/button-clip.c')
-rw-r--r-- | firmware/target/arm/as3525/sansa-clip/button-clip.c | 19 |
1 files changed, 18 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 0d4e3a6306..99a68a506d 100644 --- a/firmware/target/arm/as3525/sansa-clip/button-clip.c +++ b/firmware/target/arm/as3525/sansa-clip/button-clip.c | |||
@@ -22,6 +22,9 @@ | |||
22 | ****************************************************************************/ | 22 | ****************************************************************************/ |
23 | #include "button-target.h" | 23 | #include "button-target.h" |
24 | #include "as3525.h" | 24 | #include "as3525.h" |
25 | #ifndef BOOTLOADER | ||
26 | #include "backlight.h" | ||
27 | #endif | ||
25 | 28 | ||
26 | /* The Sansa Clip uses a button matrix that is scanned by selecting one of | 29 | /* The Sansa Clip uses a button matrix that is scanned by selecting one of |
27 | three rows and reading back the button states from the columns. | 30 | three rows and reading back the button states from the columns. |
@@ -124,5 +127,19 @@ int button_read_device(void) | |||
124 | 127 | ||
125 | bool button_hold(void) | 128 | bool button_hold(void) |
126 | { | 129 | { |
127 | return (GPIOA_PIN(3) != 0); | 130 | #ifndef BOOTLOADER |
131 | static bool hold_button_old = false; | ||
132 | #endif | ||
133 | bool hold_button = (GPIOA_PIN(3) != 0); | ||
134 | |||
135 | #ifndef BOOTLOADER | ||
136 | /* light handling */ | ||
137 | if (hold_button != hold_button_old) | ||
138 | { | ||
139 | hold_button_old = hold_button; | ||
140 | backlight_hold_changed(hold_button); | ||
141 | } | ||
142 | #endif /* BOOTLOADER */ | ||
143 | |||
144 | return hold_button; | ||
128 | } | 145 | } |