add a custom rule for building librbspeex prior to building rbutil.
[Rockbox.git] / uisimulator / sdl / button.c
blob504533bc3a658a6e38fb836e2e70e76cb8e35bad
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Felix Arends
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include "uisdl.h"
21 #include "lcd-charcells.h"
22 #include "lcd-remote.h"
23 #include "config.h"
24 #include "button.h"
25 #include "kernel.h"
26 #include "backlight.h"
27 #include "misc.h"
29 #include "debug.h"
31 static intptr_t button_data; /* data value from last message dequeued */
33 #ifdef HAVE_TOUCHPAD
34 static int mouse_coords = 0;
35 #endif
36 /* how long until repeat kicks in */
37 #define REPEAT_START 6
39 /* the speed repeat starts at */
40 #define REPEAT_INTERVAL_START 4
42 /* speed repeat finishes at */
43 #define REPEAT_INTERVAL_FINISH 2
45 #if defined(IRIVER_H100_SERIES) || defined (IRIVER_H300_SERIES)
46 int _remote_type=REMOTETYPE_H100_LCD;
48 int remote_type(void)
50 return _remote_type;
52 #endif
54 struct event_queue button_queue;
56 static int btn = 0; /* Hopefully keeps track of currently pressed keys... */
58 #ifdef HAVE_BACKLIGHT
59 static bool filter_first_keypress;
61 void set_backlight_filter_keypress(bool value)
63 filter_first_keypress = value;
65 #ifdef HAVE_REMOTE_LCD
66 static bool remote_filter_first_keypress;
68 void set_remote_backlight_filter_keypress(bool value)
70 remote_filter_first_keypress = value;
72 #endif
73 #endif
75 #ifdef HAS_BUTTON_HOLD
76 bool hold_button_state = false;
77 bool button_hold(void) {
78 return hold_button_state;
80 #endif
82 #ifdef HAS_REMOTE_BUTTON_HOLD
83 bool remote_hold_button_state = false;
84 bool remote_button_hold(void) {
85 return remote_hold_button_state;
87 #endif
89 static int lastbtn;
90 void button_event(int key, bool pressed)
92 int new_btn = 0;
93 int diff = 0;
94 int data = 0;
95 static int count = 0;
96 static int repeat_speed = REPEAT_INTERVAL_START;
97 static int repeat_count = 0;
98 static bool repeat = false;
99 static bool post = false;
100 #ifdef HAVE_BACKLIGHT
101 static bool skip_release = false;
102 #ifdef HAVE_REMOTE_LCD
103 static bool skip_remote_release = false;
104 #endif
105 #endif
106 static bool usb_connected = false;
107 if (usb_connected && key != SDLK_u)
108 return;
109 switch (key)
112 #ifdef HAVE_TOUCHPAD
113 case BUTTON_TOUCHPAD:
114 new_btn = BUTTON_TOUCHPAD;
115 data = mouse_coords;
116 break;
117 #endif
118 case SDLK_u:
119 if (!pressed)
121 usb_connected = !usb_connected;
122 if (usb_connected)
123 queue_post(&button_queue, SYS_USB_CONNECTED, 0);
124 else
125 queue_post(&button_queue, SYS_USB_DISCONNECTED, 0);
127 return;
129 #ifdef HAS_BUTTON_HOLD
130 case SDLK_h:
131 if(pressed)
133 hold_button_state = !hold_button_state;
134 DEBUGF("Hold button is %s\n", hold_button_state?"ON":"OFF");
136 return;
137 #endif
139 #ifdef HAS_REMOTE_BUTTON_HOLD
140 case SDLK_j:
141 if(pressed)
143 remote_hold_button_state = !remote_hold_button_state;
144 DEBUGF("Remote hold button is %s\n",
145 remote_hold_button_state?"ON":"OFF");
147 return;
148 #endif
150 #if CONFIG_KEYPAD == GIGABEAT_PAD
151 case SDLK_KP4:
152 case SDLK_LEFT:
153 new_btn = BUTTON_LEFT;
154 break;
155 case SDLK_KP6:
156 case SDLK_RIGHT:
157 new_btn = BUTTON_RIGHT;
158 break;
159 case SDLK_KP8:
160 case SDLK_UP:
161 new_btn = BUTTON_UP;
162 break;
163 case SDLK_KP2:
164 case SDLK_DOWN:
165 new_btn = BUTTON_DOWN;
166 break;
167 case SDLK_KP_PLUS:
168 case SDLK_F8:
169 new_btn = BUTTON_POWER;
170 break;
171 case SDLK_ESCAPE:
172 new_btn = BUTTON_POWER;
173 break;
174 case SDLK_KP_ENTER:
175 case SDLK_RETURN:
176 case SDLK_a:
177 new_btn = BUTTON_A;
178 break;
179 case SDLK_KP5:
180 case SDLK_SPACE:
181 new_btn = BUTTON_SELECT;
182 break;
183 case SDLK_KP_PERIOD:
184 case SDLK_INSERT:
185 new_btn = BUTTON_MENU;
186 break;
188 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
189 case SDLK_KP4:
190 case SDLK_LEFT:
191 new_btn = BUTTON_LEFT;
192 break;
193 case SDLK_KP6:
194 case SDLK_RIGHT:
195 new_btn = BUTTON_RIGHT;
196 break;
197 case SDLK_KP8:
198 case SDLK_UP:
199 new_btn = BUTTON_UP;
200 break;
201 case SDLK_KP2:
202 case SDLK_DOWN:
203 new_btn = BUTTON_DOWN;
204 break;
205 case SDLK_KP_PLUS:
206 case SDLK_F8:
207 new_btn = BUTTON_PLAY;
208 break;
209 case SDLK_ESCAPE:
210 new_btn = BUTTON_POWER;
211 break;
212 case SDLK_KP_ENTER:
213 case SDLK_RETURN:
214 case SDLK_a:
215 new_btn = BUTTON_POWER;
216 break;
217 case SDLK_KP_DIVIDE:
218 case SDLK_F1:
219 new_btn = BUTTON_REC;
220 break;
221 case SDLK_KP5:
222 case SDLK_SPACE:
223 new_btn = BUTTON_SELECT;
224 break;
226 #elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) \
227 || (CONFIG_KEYPAD == IPOD_4G_PAD)
228 case SDLK_KP4:
229 case SDLK_LEFT:
230 new_btn = BUTTON_LEFT;
231 break;
232 case SDLK_KP6:
233 case SDLK_RIGHT:
234 new_btn = BUTTON_RIGHT;
235 break;
236 case SDLK_KP8:
237 case SDLK_UP:
238 new_btn = BUTTON_SCROLL_BACK;
239 break;
240 case SDLK_KP2:
241 case SDLK_DOWN:
242 new_btn = BUTTON_SCROLL_FWD;
243 break;
244 case SDLK_KP_PLUS:
245 case SDLK_F8:
246 new_btn = BUTTON_PLAY;
247 break;
248 case SDLK_KP5:
249 case SDLK_SPACE:
250 new_btn = BUTTON_SELECT;
251 break;
252 case SDLK_KP_PERIOD:
253 case SDLK_INSERT:
254 new_btn = BUTTON_MENU;
255 break;
257 #elif CONFIG_KEYPAD == IRIVER_H10_PAD
258 case SDLK_KP4:
259 case SDLK_LEFT:
260 new_btn = BUTTON_LEFT;
261 break;
262 case SDLK_KP6:
263 case SDLK_RIGHT:
264 new_btn = BUTTON_RIGHT;
265 break;
266 case SDLK_KP8:
267 case SDLK_UP:
268 new_btn = BUTTON_SCROLL_UP;
269 break;
270 case SDLK_KP2:
271 case SDLK_DOWN:
272 new_btn = BUTTON_SCROLL_DOWN;
273 break;
274 case SDLK_KP_PLUS:
275 case SDLK_F8:
276 new_btn = BUTTON_POWER;
277 break;
278 case SDLK_ESCAPE:
279 new_btn = BUTTON_POWER;
280 break;
281 case SDLK_KP_DIVIDE:
282 case SDLK_F1:
283 new_btn = BUTTON_REW;
284 break;
285 case SDLK_KP_MULTIPLY:
286 case SDLK_F2:
287 new_btn = BUTTON_FF;
288 break;
289 case SDLK_KP5:
290 case SDLK_SPACE:
291 new_btn = BUTTON_PLAY;
292 break;
294 #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
295 case SDLK_t:
296 if(pressed)
297 switch(_remote_type)
299 case REMOTETYPE_UNPLUGGED:
300 _remote_type=REMOTETYPE_H100_LCD;
301 DEBUGF("Changed remote type to H100\n");
302 break;
303 case REMOTETYPE_H100_LCD:
304 _remote_type=REMOTETYPE_H300_LCD;
305 DEBUGF("Changed remote type to H300\n");
306 break;
307 case REMOTETYPE_H300_LCD:
308 _remote_type=REMOTETYPE_H300_NONLCD;
309 DEBUGF("Changed remote type to H300 NON-LCD\n");
310 break;
311 case REMOTETYPE_H300_NONLCD:
312 _remote_type=REMOTETYPE_UNPLUGGED;
313 DEBUGF("Changed remote type to none\n");
314 break;
316 break;
317 case SDLK_KP4:
318 case SDLK_LEFT:
319 new_btn = BUTTON_LEFT;
320 break;
321 case SDLK_KP6:
322 case SDLK_RIGHT:
323 new_btn = BUTTON_RIGHT;
324 break;
325 case SDLK_KP8:
326 case SDLK_UP:
327 new_btn = BUTTON_UP;
328 break;
329 case SDLK_KP2:
330 case SDLK_DOWN:
331 new_btn = BUTTON_DOWN;
332 break;
333 case SDLK_KP_PLUS:
334 case SDLK_F8:
335 new_btn = BUTTON_ON;
336 break;
337 case SDLK_KP_ENTER:
338 case SDLK_RETURN:
339 case SDLK_a:
340 new_btn = BUTTON_OFF;
341 break;
342 case SDLK_KP_DIVIDE:
343 case SDLK_F1:
344 new_btn = BUTTON_REC;
345 break;
346 case SDLK_KP5:
347 case SDLK_SPACE:
348 new_btn = BUTTON_SELECT;
349 break;
350 case SDLK_KP_PERIOD:
351 case SDLK_INSERT:
352 new_btn = BUTTON_MODE;
353 break;
355 #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
356 case SDLK_KP4:
357 case SDLK_LEFT:
358 new_btn = BUTTON_LEFT;
359 break;
360 case SDLK_KP6:
361 case SDLK_RIGHT:
362 new_btn = BUTTON_RIGHT;
363 break;
364 case SDLK_KP8:
365 case SDLK_UP:
366 new_btn = BUTTON_UP;
367 break;
368 case SDLK_KP2:
369 case SDLK_DOWN:
370 new_btn = BUTTON_DOWN;
371 break;
372 case SDLK_KP_PLUS:
373 case SDLK_F8:
374 new_btn = BUTTON_PLAY;
375 break;
376 case SDLK_KP_ENTER:
377 case SDLK_RETURN:
378 case SDLK_a:
379 new_btn = BUTTON_EQ;
380 break;
381 case SDLK_KP5:
382 case SDLK_SPACE:
383 new_btn = BUTTON_SELECT;
384 break;
385 case SDLK_KP_PERIOD:
386 case SDLK_INSERT:
387 new_btn = BUTTON_MODE;
388 break;
390 #elif CONFIG_KEYPAD == ONDIO_PAD
391 case SDLK_KP4:
392 case SDLK_LEFT:
393 new_btn = BUTTON_LEFT;
394 break;
395 case SDLK_KP6:
396 case SDLK_RIGHT:
397 new_btn = BUTTON_RIGHT;
398 break;
399 case SDLK_KP8:
400 case SDLK_UP:
401 new_btn = BUTTON_UP;
402 break;
403 case SDLK_KP2:
404 case SDLK_DOWN:
405 new_btn = BUTTON_DOWN;
406 break;
407 case SDLK_KP_ENTER:
408 case SDLK_RETURN:
409 case SDLK_a:
410 new_btn = BUTTON_OFF;
411 break;
412 case SDLK_KP_PERIOD:
413 case SDLK_INSERT:
414 new_btn = BUTTON_MENU;
415 break;
417 #elif CONFIG_KEYPAD == PLAYER_PAD
418 case SDLK_KP4:
419 case SDLK_LEFT:
420 new_btn = BUTTON_LEFT;
421 break;
422 case SDLK_KP6:
423 case SDLK_RIGHT:
424 new_btn = BUTTON_RIGHT;
425 break;
426 case SDLK_KP8:
427 case SDLK_UP:
428 new_btn = BUTTON_PLAY;
429 break;
430 case SDLK_KP2:
431 case SDLK_DOWN:
432 new_btn = BUTTON_STOP;
433 break;
434 case SDLK_KP_PLUS:
435 case SDLK_F8:
436 new_btn = BUTTON_ON;
437 break;
438 case SDLK_KP_PERIOD:
439 case SDLK_INSERT:
440 new_btn = BUTTON_MENU;
441 break;
443 #elif CONFIG_KEYPAD == RECORDER_PAD
444 case SDLK_KP4:
445 case SDLK_LEFT:
446 new_btn = BUTTON_LEFT;
447 break;
448 case SDLK_KP6:
449 case SDLK_RIGHT:
450 new_btn = BUTTON_RIGHT;
451 break;
452 case SDLK_KP8:
453 case SDLK_UP:
454 new_btn = BUTTON_UP;
455 break;
456 case SDLK_KP2:
457 case SDLK_DOWN:
458 new_btn = BUTTON_DOWN;
459 break;
460 case SDLK_KP_PLUS:
461 case SDLK_F8:
462 new_btn = BUTTON_ON;
463 break;
464 case SDLK_KP_ENTER:
465 case SDLK_RETURN:
466 case SDLK_a:
467 new_btn = BUTTON_OFF;
468 break;
469 case SDLK_KP_DIVIDE:
470 case SDLK_F1:
471 new_btn = BUTTON_F1;
472 break;
473 case SDLK_KP_MULTIPLY:
474 case SDLK_F2:
475 new_btn = BUTTON_F2;
476 break;
477 case SDLK_KP_MINUS:
478 case SDLK_F3:
479 new_btn = BUTTON_F3;
480 break;
481 case SDLK_KP5:
482 case SDLK_SPACE:
483 new_btn = BUTTON_PLAY;
484 break;
486 #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
487 case SDLK_KP4:
488 case SDLK_LEFT:
489 new_btn = BUTTON_LEFT;
490 break;
491 case SDLK_KP6:
492 case SDLK_RIGHT:
493 new_btn = BUTTON_RIGHT;
494 break;
495 case SDLK_KP8:
496 case SDLK_UP:
497 new_btn = BUTTON_UP;
498 break;
499 case SDLK_KP2:
500 case SDLK_DOWN:
501 new_btn = BUTTON_DOWN;
502 break;
503 case SDLK_KP_PLUS:
504 case SDLK_F8:
505 new_btn = BUTTON_ON;
506 break;
507 case SDLK_KP_ENTER:
508 case SDLK_RETURN:
509 case SDLK_a:
510 new_btn = BUTTON_OFF;
511 break;
512 case SDLK_KP_DIVIDE:
513 case SDLK_F1:
514 new_btn = BUTTON_F1;
515 break;
516 case SDLK_KP_MULTIPLY:
517 case SDLK_F2:
518 new_btn = BUTTON_F2;
519 break;
520 case SDLK_KP_MINUS:
521 case SDLK_F3:
522 new_btn = BUTTON_F3;
523 break;
524 case SDLK_KP5:
525 case SDLK_SPACE:
526 new_btn = BUTTON_SELECT;
527 break;
529 #elif CONFIG_KEYPAD == SANSA_E200_PAD
530 case SDLK_KP4:
531 case SDLK_LEFT:
532 new_btn = BUTTON_LEFT;
533 break;
534 case SDLK_KP6:
535 case SDLK_RIGHT:
536 new_btn = BUTTON_RIGHT;
537 break;
538 case SDLK_KP8:
539 case SDLK_UP:
540 new_btn = BUTTON_SCROLL_UP;
541 break;
542 case SDLK_KP2:
543 case SDLK_DOWN:
544 new_btn = BUTTON_SCROLL_DOWN;
545 break;
546 case SDLK_KP9:
547 new_btn = BUTTON_UP;
548 break;
549 case SDLK_KP3:
550 new_btn = BUTTON_DOWN;
551 break;
552 case SDLK_KP1:
553 new_btn = BUTTON_POWER;
554 break;
555 case SDLK_KP7:
556 new_btn = BUTTON_REC;
557 break;
558 case SDLK_KP5:
559 case SDLK_SPACE:
560 new_btn = BUTTON_SELECT;
561 break;
563 #elif CONFIG_KEYPAD == SANSA_C200_PAD
564 case SDLK_KP4:
565 case SDLK_LEFT:
566 new_btn = BUTTON_LEFT;
567 break;
568 case SDLK_KP6:
569 case SDLK_RIGHT:
570 new_btn = BUTTON_RIGHT;
571 break;
572 case SDLK_KP8:
573 case SDLK_UP:
574 new_btn = BUTTON_UP;
575 break;
576 case SDLK_KP2:
577 case SDLK_DOWN:
578 new_btn = BUTTON_DOWN;
579 break;
580 case SDLK_KP3:
581 new_btn = BUTTON_POWER;
582 break;
583 case SDLK_KP1:
584 new_btn = BUTTON_REC;
585 break;
586 case SDLK_KP5:
587 case SDLK_KP_ENTER:
588 case SDLK_RETURN:
589 new_btn = BUTTON_SELECT;
590 break;
591 case SDLK_KP7:
592 new_btn = BUTTON_VOL_DOWN;
593 break;
594 case SDLK_KP9:
595 new_btn = BUTTON_VOL_UP;
596 break;
598 #elif CONFIG_KEYPAD == MROBE500_PAD
599 case SDLK_KP4:
600 case SDLK_LEFT:
601 new_btn = BUTTON_LEFT;
602 break;
603 case SDLK_KP6:
604 case SDLK_RIGHT:
605 new_btn = BUTTON_RIGHT;
606 break;
607 case SDLK_KP8:
608 case SDLK_UP:
609 new_btn = BUTTON_RC_PLAY;
610 break;
611 case SDLK_KP2:
612 case SDLK_DOWN:
613 new_btn = BUTTON_RC_DOWN;
614 break;
615 case SDLK_KP_PLUS:
616 case SDLK_F8:
617 new_btn = BUTTON_POWER;
618 break;
619 case SDLK_ESCAPE:
620 new_btn = BUTTON_POWER;
621 break;
622 case SDLK_KP_ENTER:
623 case SDLK_RETURN:
624 case SDLK_a:
625 new_btn = BUTTON_RC_VOL_UP;
626 break;
627 case SDLK_KP5:
628 case SDLK_SPACE:
629 new_btn = BUTTON_RC_HEART;
630 break;
631 case SDLK_KP_PERIOD:
632 case SDLK_INSERT:
633 new_btn = BUTTON_RC_MODE;
634 break;
635 #else
636 #error No keymap defined!
637 #endif /* CONFIG_KEYPAD */
638 case SDLK_KP0:
639 case SDLK_F5:
640 if(pressed)
642 queue_broadcast(SYS_SCREENDUMP, 0);
643 return;
645 break;
648 if (pressed)
649 btn |= new_btn;
650 else
651 btn &= ~new_btn;
653 /* Lots of stuff copied from real button.c. Not good, I think... */
655 /* Find out if a key has been released */
656 diff = btn ^ lastbtn;
657 if(diff && (btn & diff) == 0)
659 #ifdef HAVE_BACKLIGHT
660 #ifdef HAVE_REMOTE_LCD
661 if(diff & BUTTON_REMOTE)
662 if(!skip_remote_release)
663 queue_post(&button_queue, BUTTON_REL | diff, data);
664 else
665 skip_remote_release = false;
666 else
667 #endif
668 if(!skip_release)
669 queue_post(&button_queue, BUTTON_REL | diff, data);
670 else
671 skip_release = false;
672 #else
673 queue_post(&button_queue, BUTTON_REL | diff, data);
674 #endif
677 else
679 if ( btn )
681 /* normal keypress */
682 if ( btn != lastbtn )
684 post = true;
685 repeat = false;
686 repeat_speed = REPEAT_INTERVAL_START;
689 else /* repeat? */
691 if ( repeat )
693 if (!post)
694 count--;
695 if (count == 0)
697 post = true;
698 /* yes we have repeat */
699 repeat_speed--;
700 if (repeat_speed < REPEAT_INTERVAL_FINISH)
701 repeat_speed = REPEAT_INTERVAL_FINISH;
702 count = repeat_speed;
704 repeat_count++;
707 else
709 if (count++ > REPEAT_START)
711 post = true;
712 repeat = true;
713 repeat_count = 0;
714 /* initial repeat */
715 count = REPEAT_INTERVAL_START;
719 if ( post )
721 if(repeat)
723 if (queue_empty(&button_queue))
725 queue_post(&button_queue, BUTTON_REPEAT | btn, data);
726 #ifdef HAVE_BACKLIGHT
727 #ifdef HAVE_REMOTE_LCD
728 if(btn & BUTTON_REMOTE)
730 if(skip_remote_release)
731 skip_remote_release = false;
733 else
734 #endif
735 if(skip_release)
736 skip_release = false;
737 #endif
738 post = false;
741 else
743 #ifdef HAVE_BACKLIGHT
744 #ifdef HAVE_REMOTE_LCD
745 if (btn & BUTTON_REMOTE) {
746 if (!remote_filter_first_keypress || is_remote_backlight_on())
747 queue_post(&button_queue, btn, data);
748 else
749 skip_remote_release = true;
751 else
752 #endif
753 if (!filter_first_keypress || is_backlight_on())
754 queue_post(&button_queue, btn, data);
755 else
756 skip_release = true;
757 #else /* no backlight, nothing to skip */
758 queue_post(&button_queue, btn, data);
759 #endif
760 post = false;
763 #ifdef HAVE_REMOTE_LCD
764 if(btn & BUTTON_REMOTE)
765 remote_backlight_on();
766 else
767 #endif
768 backlight_on();
772 else
774 repeat = false;
775 count = 0;
778 lastbtn = btn & ~(BUTTON_REL | BUTTON_REPEAT);
781 /* Again copied from real button.c... */
783 int button_queue_count( void )
785 return queue_count(&button_queue);
788 long button_get(bool block)
790 struct queue_event ev;
792 if ( block || !queue_empty(&button_queue) ) {
793 queue_wait(&button_queue, &ev);
794 button_data = ev.data;
795 return ev.id;
797 return BUTTON_NONE;
800 long button_get_w_tmo(int ticks)
802 struct queue_event ev;
803 queue_wait_w_tmo(&button_queue, &ev, ticks);
804 if (ev.id == SYS_TIMEOUT)
805 ev.id = BUTTON_NONE;
806 else
807 button_data = ev.data;
809 return ev.id;
812 intptr_t button_get_data(void)
814 #ifdef HAVE_TOUCHPAD
815 return button_data;
816 #else
817 /* Needed by the accelerating wheel driver for Sansa e200 */
818 return 1 << 24;
819 #endif
822 #ifdef HAVE_TOUCHPAD
823 extern bool debug_wps;
824 void mouse_tick_task(void)
826 static int last_check = 0;
827 int x,y;
828 if (TIME_BEFORE(current_tick, last_check+(HZ/10)))
829 return;
830 last_check = current_tick;
831 if (SDL_GetMouseState(&x, &y) & SDL_BUTTON(SDL_BUTTON_LEFT))
833 mouse_coords = (x<<16)|y;
834 button_event(BUTTON_TOUCHPAD, true);
835 if (debug_wps)
836 printf("Mouse at: (%d, %d)\n", x, y);
838 else if (lastbtn == BUTTON_TOUCHPAD)
840 button_event(BUTTON_TOUCHPAD, false);
841 mouse_coords = 0;
844 #endif
845 void button_init(void)
847 #ifdef HAVE_TOUCHPAD
848 tick_add_task(mouse_tick_task);
849 #endif
852 int button_status(void)
854 return btn;
857 void button_clear_queue(void)
859 queue_clear(&button_queue);