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 +++++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) (limited to 'firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c') 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 */ -- cgit v1.2.3