diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2009-08-15 15:02:51 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2009-08-15 15:02:51 +0000 |
commit | 6932fa397ba9b9cc99ec248602f43aba8e1f86c9 (patch) | |
tree | fb954156a20423660c4a48c7c9750bfad5937192 | |
parent | bd4fc82b3b97b2b3ba60af02e4cedc6b9ee26b7b (diff) | |
download | rockbox-6932fa397ba9b9cc99ec248602f43aba8e1f86c9.tar.gz rockbox-6932fa397ba9b9cc99ec248602f43aba8e1f86c9.zip |
Sansa Clip & m200v4 : calls backlight_hold_changed() when hold button is toggled
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22323 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/as3525/sansa-clip/button-clip.c | 19 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c | 24 |
2 files changed, 38 insertions, 5 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 | } |
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 | } |