From 56e2eea175fe10a6aba6ac797376ce12129e7694 Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Sat, 7 Jan 2012 19:44:30 +0000 Subject: 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 --- .../arm/tms320dm320/mrobe-500/button-mr500.c | 50 +++++++++++++++++++++- .../arm/tms320dm320/mrobe-500/lcd-remote-mr500.c | 50 ---------------------- .../arm/tms320dm320/mrobe-500/lcd-remote-target.h | 4 -- 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) return hold_button; } +#ifdef HAVE_REMOTE_LCD +static bool remote_hold_button; +static int remote_read_buttons(void) +{ + static char read_buffer[5]; + int read_button = BUTTON_NONE; + + static int oldbutton=BUTTON_NONE; + + /* Handle remote buttons */ + if(uart1_gets_queue(read_buffer, 5)>=0) + { + int button_location; + + for(button_location=0;button_location<4;button_location++) + { + if((read_buffer[button_location]&0xF0)==0xF0 + && (read_buffer[button_location+1]&0xF0)!=0xF0) + break; + } + + if(button_location==4) + button_location=0; + + button_location++; + + read_button |= read_buffer[button_location]; + + /* Find the hold status location */ + if(button_location==4) + button_location=0; + else + button_location++; + + remote_hold_button=((read_buffer[button_location]&0x80)?true:false); + + uart1_clear_queue(); + oldbutton=read_button; + } + else + read_button=oldbutton; + + return read_button; +} +#endif + /* Since this is a touchscreen, the expectation in higher levels is that the * previous touch location is maintained when a release occurs. This is * intended to mimic a mouse or other similar pointing device. @@ -137,8 +183,8 @@ int button_read_device(int *data) #if defined(HAVE_REMOTE_LCD) /* Read data from the remote */ - button_read |= remote_read_device(); - hold_button=remote_button_hold(); + button_read |= remote_read_buttons(); + hold_button=remote_hold_button; #endif /* 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 DRAW_PAUSE, } remote_state_draw = DRAW_TOP, remote_state_draw_next; -static bool remote_hold_button=false; - bool remote_initialized=true; 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) remote_state_control=REMOTE_CONTROL_DRAW; } -bool remote_button_hold(void) -{ - return remote_hold_button; -} - -int remote_read_device(void) -{ - static char read_buffer[5]; - int read_button = BUTTON_NONE; - - static int oldbutton=BUTTON_NONE; - - /* Handle remote buttons */ - if(uart1_gets_queue(read_buffer, 5)>=0) - { - int button_location; - - for(button_location=0;button_location<4;button_location++) - { - if((read_buffer[button_location]&0xF0)==0xF0 - && (read_buffer[button_location+1]&0xF0)!=0xF0) - break; - } - - if(button_location==4) - button_location=0; - - button_location++; - - read_button |= read_buffer[button_location]; - - /* Find the hold status location */ - if(button_location==4) - button_location=0; - else - button_location++; - - remote_hold_button=((read_buffer[button_location]&0x80)?true:false); - - uart1_clear_queue(); - oldbutton=read_button; - } - else - read_button=oldbutton; - - return read_button; -} - void _remote_backlight_on(void) { 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 @@ #define LCD_REMOTE_TARGET_H void lcd_remote_powersave(bool on); - void lcd_remote_sleep(void); -int remote_read_device(void); -bool remote_button_hold(void); - #endif -- cgit v1.2.3