diff options
Diffstat (limited to 'firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c')
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c | 57 |
1 files changed, 54 insertions, 3 deletions
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 0a41b2241f..3ff5d9c2fd 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "adc.h" | 26 | #include "adc.h" |
27 | #include "scroll_engine.h" | 27 | #include "scroll_engine.h" |
28 | #include "uart-target.h" | 28 | #include "uart-target.h" |
29 | #include "button.h" | ||
29 | 30 | ||
30 | static enum remote_control_states | 31 | static enum remote_control_states |
31 | { | 32 | { |
@@ -44,11 +45,13 @@ static enum remote_draw_states | |||
44 | DRAW_PAUSE, | 45 | DRAW_PAUSE, |
45 | } remote_state_draw = DRAW_TOP, remote_state_draw_next; | 46 | } remote_state_draw = DRAW_TOP, remote_state_draw_next; |
46 | 47 | ||
48 | static bool remote_hold_button=false; | ||
49 | |||
47 | bool remote_initialized=true; | 50 | bool remote_initialized=true; |
48 | 51 | ||
49 | unsigned char remote_contrast=DEFAULT_REMOTE_CONTRAST_SETTING; | 52 | static unsigned char remote_contrast=DEFAULT_REMOTE_CONTRAST_SETTING; |
50 | unsigned char remote_power=0x00; | 53 | static unsigned char remote_power=0x00; |
51 | unsigned char remote_mask=0x00; | 54 | static unsigned char remote_mask=0x00; |
52 | 55 | ||
53 | /*** hardware configuration ***/ | 56 | /*** hardware configuration ***/ |
54 | 57 | ||
@@ -274,6 +277,54 @@ void lcd_remote_update_rect(int x, int y, int width, int height) | |||
274 | remote_state_control=REMOTE_CONTROL_DRAW; | 277 | remote_state_control=REMOTE_CONTROL_DRAW; |
275 | } | 278 | } |
276 | 279 | ||
280 | bool remote_button_hold(void) | ||
281 | { | ||
282 | return remote_hold_button; | ||
283 | } | ||
284 | |||
285 | int remote_read_device(void) | ||
286 | { | ||
287 | char read_buffer[5]; | ||
288 | int read_button = BUTTON_NONE; | ||
289 | |||
290 | static int oldbutton=BUTTON_NONE; | ||
291 | |||
292 | /* Handle remote buttons */ | ||
293 | if(uart1_gets_queue(read_buffer, 5)>=0) | ||
294 | { | ||
295 | int button_location; | ||
296 | |||
297 | for(button_location=0;button_location<4;button_location++) | ||
298 | { | ||
299 | if((read_buffer[button_location]&0xF0)==0xF0 | ||
300 | && (read_buffer[button_location+1]&0xF0)!=0xF0) | ||
301 | break; | ||
302 | } | ||
303 | |||
304 | if(button_location==4) | ||
305 | button_location=0; | ||
306 | |||
307 | button_location++; | ||
308 | |||
309 | read_button |= read_buffer[button_location]; | ||
310 | |||
311 | /* Find the hold status location */ | ||
312 | if(button_location==4) | ||
313 | button_location=0; | ||
314 | else | ||
315 | button_location++; | ||
316 | |||
317 | remote_hold_button=((read_buffer[button_location]&0x80)?true:false); | ||
318 | |||
319 | uart1_clear_queue(); | ||
320 | oldbutton=read_button; | ||
321 | } | ||
322 | else | ||
323 | read_button=oldbutton; | ||
324 | |||
325 | return read_button; | ||
326 | } | ||
327 | |||
277 | void _remote_backlight_on(void) | 328 | void _remote_backlight_on(void) |
278 | { | 329 | { |
279 | remote_power|=0x40; | 330 | remote_power|=0x40; |