diff options
Diffstat (limited to 'firmware/target/arm/as3525/sansa-m200v4')
-rw-r--r-- | firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c b/firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c index 5220fc4925..af57f97051 100644 --- a/firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c +++ b/firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c | |||
@@ -23,6 +23,10 @@ | |||
23 | #include "cpu.h" | 23 | #include "cpu.h" |
24 | #include "button.h" | 24 | #include "button.h" |
25 | 25 | ||
26 | #ifndef BOOTLOADER | ||
27 | #include "backlight.h" | ||
28 | #endif | ||
29 | |||
26 | void button_init_device(void) | 30 | void button_init_device(void) |
27 | { | 31 | { |
28 | GPIOA_DIR &= ~((1<<3) | (1<<2) | (1<<1) | (1<<0)); /* A3-A0 is input */ | 32 | GPIOA_DIR &= ~((1<<3) | (1<<2) | (1<<1) | (1<<0)); /* A3-A0 is input */ |
@@ -89,12 +93,24 @@ int button_read_device(void) | |||
89 | 93 | ||
90 | bool button_hold(void) | 94 | bool button_hold(void) |
91 | { | 95 | { |
92 | bool ret = false; | 96 | #ifndef BOOTLOADER |
97 | static bool hold_button_old = false; | ||
98 | #endif | ||
99 | bool hold_button = false; | ||
93 | 100 | ||
94 | GPIOA_PIN(6) = (1<<6); | 101 | GPIOA_PIN(6) = (1<<6); |
95 | if (GPIOA_PIN(2)) | 102 | if (GPIOA_PIN(2)) |
96 | ret = true; | 103 | hold_button = true; |
97 | GPIOA_PIN(6) = 0x00; | 104 | GPIOA_PIN(6) = 0x00; |
98 | 105 | ||
99 | return ret; | 106 | #ifndef BOOTLOADER |
107 | /* light handling */ | ||
108 | if (hold_button != hold_button_old) | ||
109 | { | ||
110 | hold_button_old = hold_button; | ||
111 | backlight_hold_changed(hold_button); | ||
112 | } | ||
113 | #endif /* BOOTLOADER */ | ||
114 | |||
115 | return hold_button; | ||
100 | } | 116 | } |