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/tms320dm320/mrobe-500/button-mr500.c | |
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/tms320dm320/mrobe-500/button-mr500.c')
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | 50 |
1 files changed, 48 insertions, 2 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 */ |