diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2009-04-16 03:10:01 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2009-04-16 03:10:01 +0000 |
commit | 493d3a03b3733b2c529d04a168c1915217f5c0e9 (patch) | |
tree | f33adf2da6c7409ef226ad6faeb359a0a516f76a | |
parent | 3c85268f1857d5515b9ddd4ce64fa66cfa6bf955 (diff) | |
download | rockbox-493d3a03b3733b2c529d04a168c1915217f5c0e9.tar.gz rockbox-493d3a03b3733b2c529d04a168c1915217f5c0e9.zip |
M:Robe 500: Add support for hold button on the remote.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20712 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c index 00096ce2ad..daa53f794f 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2007 by Karl Kurbjun | 10 | * Copyright (C) 2007, 2009 by Karl Kurbjun |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 13 | * modify it under the terms of the GNU General Public License |
@@ -42,6 +42,7 @@ | |||
42 | /* but always the same one for the session? */ | 42 | /* but always the same one for the session? */ |
43 | static short last_x, last_y, last_z1, last_z2; /* for the touch screen */ | 43 | static short last_x, last_y, last_z1, last_z2; /* for the touch screen */ |
44 | static bool touch_available = false; | 44 | static bool touch_available = false; |
45 | static bool hold_button = false; | ||
45 | 46 | ||
46 | static struct touch_calibration_point topleft, bottomright; | 47 | static struct touch_calibration_point topleft, bottomright; |
47 | 48 | ||
@@ -125,7 +126,7 @@ void button_init_device(void) | |||
125 | 126 | ||
126 | inline bool button_hold(void) | 127 | inline bool button_hold(void) |
127 | { | 128 | { |
128 | return false; | 129 | return hold_button; |
129 | } | 130 | } |
130 | 131 | ||
131 | #define TOUCH_MARGIN 8 | 132 | #define TOUCH_MARGIN 8 |
@@ -133,8 +134,9 @@ char r_buffer[5]; | |||
133 | int r_button = BUTTON_NONE; | 134 | int r_button = BUTTON_NONE; |
134 | int button_read_device(int *data) | 135 | int button_read_device(int *data) |
135 | { | 136 | { |
136 | int retval, calbuf; | 137 | int retval, button1_location, button2_location; |
137 | static int oldbutton = BUTTON_NONE; | 138 | static int oldbutton = BUTTON_NONE; |
139 | static bool oldhold = false; | ||
138 | 140 | ||
139 | static long last_touch = 0; | 141 | static long last_touch = 0; |
140 | 142 | ||
@@ -187,24 +189,47 @@ int button_read_device(int *data) | |||
187 | 189 | ||
188 | retval=uart1_gets_queue(r_buffer, 5); | 190 | retval=uart1_gets_queue(r_buffer, 5); |
189 | 191 | ||
190 | for(calbuf=0;calbuf<4;calbuf++) | 192 | for(button1_location=0;button1_location<4;button1_location++) |
191 | { | 193 | { |
192 | if((r_buffer[calbuf]&0xF0)==0xF0 && (r_buffer[calbuf+1]&0xF0)!=0xF0) | 194 | if((r_buffer[button1_location]&0xF0)==0xF0 |
195 | && (r_buffer[button1_location+1]&0xF0)!=0xF0) | ||
193 | break; | 196 | break; |
194 | } | 197 | } |
195 | calbuf++; | 198 | button1_location++; |
196 | if(calbuf==5) | 199 | if(button1_location==5) |
197 | calbuf=0; | 200 | button1_location=0; |
201 | |||
202 | if(button1_location==4) | ||
203 | button2_location=0; | ||
204 | else | ||
205 | button2_location=button1_location+1; | ||
206 | |||
198 | if(retval>=0) | 207 | if(retval>=0) |
199 | { | 208 | { |
200 | uart1_clear_queue(); | 209 | uart1_clear_queue(); |
201 | r_button |= r_buffer[calbuf]; | 210 | r_button |= r_buffer[button1_location]; |
202 | oldbutton=r_button; | 211 | oldbutton=r_button; |
212 | hold_button=((r_buffer[button2_location]&0x80)?true:false); | ||
203 | } | 213 | } |
204 | else | 214 | else |
205 | { | 215 | { |
206 | r_button=oldbutton; | 216 | r_button=oldbutton; |
207 | } | 217 | } |
218 | |||
219 | #ifndef BOOTLOADER | ||
220 | /* give BL notice if HB state chaged */ | ||
221 | if (hold_button != oldhold) | ||
222 | { | ||
223 | backlight_hold_changed(hold_button); | ||
224 | oldhold=hold_button; | ||
225 | } | ||
226 | #endif | ||
227 | |||
228 | if (hold_button) | ||
229 | { | ||
230 | r_button=BUTTON_NONE; | ||
231 | oldbutton=r_button; | ||
232 | } | ||
208 | 233 | ||
209 | return r_button; | 234 | return r_button; |
210 | } | 235 | } |