diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2012-01-07 19:44:30 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2012-01-07 19:44:30 +0000 |
commit | 56e2eea175fe10a6aba6ac797376ce12129e7694 (patch) | |
tree | 4d06f766ba8cbb308d0d049a6730c7823e97c2fc /firmware/target/arm | |
parent | b612263b1e75859aa773c63a9a5bfe7978f35e77 (diff) | |
download | rockbox-56e2eea175fe10a6aba6ac797376ce12129e7694.tar.gz rockbox-56e2eea175fe10a6aba6ac797376ce12129e7694.zip |
mr500: move remote button reading code to buttom-mr500.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31609 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
3 files changed, 48 insertions, 56 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c index 3aa6009c9e..a3638cadc5 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | |||
@@ -108,6 +108,52 @@ inline bool button_hold(void) | |||
108 | return hold_button; | 108 | return hold_button; |
109 | } | 109 | } |
110 | 110 | ||
111 | #ifdef HAVE_REMOTE_LCD | ||
112 | static bool remote_hold_button; | ||
113 | static int remote_read_buttons(void) | ||
114 | { | ||
115 | static char read_buffer[5]; | ||
116 | int read_button = BUTTON_NONE; | ||
117 | |||
118 | static int oldbutton=BUTTON_NONE; | ||
119 | |||
120 | /* Handle remote buttons */ | ||
121 | if(uart1_gets_queue(read_buffer, 5)>=0) | ||
122 | { | ||
123 | int button_location; | ||
124 | |||
125 | for(button_location=0;button_location<4;button_location++) | ||
126 | { | ||
127 | if((read_buffer[button_location]&0xF0)==0xF0 | ||
128 | && (read_buffer[button_location+1]&0xF0)!=0xF0) | ||
129 | break; | ||
130 | } | ||
131 | |||
132 | if(button_location==4) | ||
133 | button_location=0; | ||
134 | |||
135 | button_location++; | ||
136 | |||
137 | read_button |= read_buffer[button_location]; | ||
138 | |||
139 | /* Find the hold status location */ | ||
140 | if(button_location==4) | ||
141 | button_location=0; | ||
142 | else | ||
143 | button_location++; | ||
144 | |||
145 | remote_hold_button=((read_buffer[button_location]&0x80)?true:false); | ||
146 | |||
147 | uart1_clear_queue(); | ||
148 | oldbutton=read_button; | ||
149 | } | ||
150 | else | ||
151 | read_button=oldbutton; | ||
152 | |||
153 | return read_button; | ||
154 | } | ||
155 | #endif | ||
156 | |||
111 | /* Since this is a touchscreen, the expectation in higher levels is that the | 157 | /* Since this is a touchscreen, the expectation in higher levels is that the |
112 | * previous touch location is maintained when a release occurs. This is | 158 | * previous touch location is maintained when a release occurs. This is |
113 | * intended to mimic a mouse or other similar pointing device. | 159 | * intended to mimic a mouse or other similar pointing device. |
@@ -137,8 +183,8 @@ int button_read_device(int *data) | |||
137 | 183 | ||
138 | #if defined(HAVE_REMOTE_LCD) | 184 | #if defined(HAVE_REMOTE_LCD) |
139 | /* Read data from the remote */ | 185 | /* Read data from the remote */ |
140 | button_read |= remote_read_device(); | 186 | button_read |= remote_read_buttons(); |
141 | hold_button=remote_button_hold(); | 187 | hold_button=remote_hold_button; |
142 | #endif | 188 | #endif |
143 | 189 | ||
144 | /* Take care of hold notifications */ | 190 | /* Take care of hold notifications */ |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c index 2e3a8bed3d..2a600d7d18 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c | |||
@@ -45,8 +45,6 @@ static enum remote_draw_states | |||
45 | DRAW_PAUSE, | 45 | DRAW_PAUSE, |
46 | } remote_state_draw = DRAW_TOP, remote_state_draw_next; | 46 | } remote_state_draw = DRAW_TOP, remote_state_draw_next; |
47 | 47 | ||
48 | static bool remote_hold_button=false; | ||
49 | |||
50 | bool remote_initialized=true; | 48 | bool remote_initialized=true; |
51 | 49 | ||
52 | static unsigned char remote_contrast=DEFAULT_REMOTE_CONTRAST_SETTING; | 50 | static unsigned char remote_contrast=DEFAULT_REMOTE_CONTRAST_SETTING; |
@@ -292,54 +290,6 @@ void lcd_remote_update_rect(int x, int y, int width, int height) | |||
292 | remote_state_control=REMOTE_CONTROL_DRAW; | 290 | remote_state_control=REMOTE_CONTROL_DRAW; |
293 | } | 291 | } |
294 | 292 | ||
295 | bool remote_button_hold(void) | ||
296 | { | ||
297 | return remote_hold_button; | ||
298 | } | ||
299 | |||
300 | int remote_read_device(void) | ||
301 | { | ||
302 | static char read_buffer[5]; | ||
303 | int read_button = BUTTON_NONE; | ||
304 | |||
305 | static int oldbutton=BUTTON_NONE; | ||
306 | |||
307 | /* Handle remote buttons */ | ||
308 | if(uart1_gets_queue(read_buffer, 5)>=0) | ||
309 | { | ||
310 | int button_location; | ||
311 | |||
312 | for(button_location=0;button_location<4;button_location++) | ||
313 | { | ||
314 | if((read_buffer[button_location]&0xF0)==0xF0 | ||
315 | && (read_buffer[button_location+1]&0xF0)!=0xF0) | ||
316 | break; | ||
317 | } | ||
318 | |||
319 | if(button_location==4) | ||
320 | button_location=0; | ||
321 | |||
322 | button_location++; | ||
323 | |||
324 | read_button |= read_buffer[button_location]; | ||
325 | |||
326 | /* Find the hold status location */ | ||
327 | if(button_location==4) | ||
328 | button_location=0; | ||
329 | else | ||
330 | button_location++; | ||
331 | |||
332 | remote_hold_button=((read_buffer[button_location]&0x80)?true:false); | ||
333 | |||
334 | uart1_clear_queue(); | ||
335 | oldbutton=read_button; | ||
336 | } | ||
337 | else | ||
338 | read_button=oldbutton; | ||
339 | |||
340 | return read_button; | ||
341 | } | ||
342 | |||
343 | void _remote_backlight_on(void) | 293 | void _remote_backlight_on(void) |
344 | { | 294 | { |
345 | remote_power|=0x40; | 295 | remote_power|=0x40; |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-target.h b/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-target.h index 2790388833..fba9077571 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-target.h +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-target.h | |||
@@ -22,10 +22,6 @@ | |||
22 | #define LCD_REMOTE_TARGET_H | 22 | #define LCD_REMOTE_TARGET_H |
23 | 23 | ||
24 | void lcd_remote_powersave(bool on); | 24 | void lcd_remote_powersave(bool on); |
25 | |||
26 | void lcd_remote_sleep(void); | 25 | void lcd_remote_sleep(void); |
27 | 26 | ||
28 | int remote_read_device(void); | ||
29 | bool remote_button_hold(void); | ||
30 | |||
31 | #endif | 27 | #endif |