Colour targets: Revert an optimisation from almost 18 months ago that actually turned...
[Rockbox.git] / firmware / export / button.h
blobf47639b3c77b08d8e1d1ff1f38171f3a3ec23561
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Daniel Stenberg
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef _BUTTON_H_
22 #define _BUTTON_H_
24 #include <stdbool.h>
25 #include <inttypes.h>
26 #include "config.h"
27 #ifndef __PCTOOL__
28 #include "button-target.h"
29 #endif
31 extern struct event_queue button_queue;
33 void button_init (void);
34 void button_close(void);
35 int button_queue_count(void);
36 long button_get (bool block);
37 long button_get_w_tmo(int ticks);
38 intptr_t button_get_data(void);
39 int button_status(void);
40 void button_clear_queue(void);
41 #ifdef HAVE_LCD_BITMAP
42 void button_set_flip(bool flip); /* turn 180 degrees */
43 #endif
44 #ifdef HAVE_BACKLIGHT
45 void set_backlight_filter_keypress(bool value);
46 #ifdef HAVE_REMOTE_LCD
47 void set_remote_backlight_filter_keypress(bool value);
48 #endif
49 #endif
51 #ifdef HAVE_HEADPHONE_DETECTION
52 bool headphones_inserted(void);
53 #endif
54 #ifdef HAVE_WHEEL_POSITION
55 int wheel_status(void);
56 void wheel_send_events(bool send);
57 #endif
59 #ifdef HAVE_SCROLLWHEEL
60 int button_apply_acceleration(const unsigned int data);
61 #endif
63 #define BUTTON_NONE 0x00000000
65 /* Button modifiers */
66 #define BUTTON_REL 0x02000000
67 #define BUTTON_REPEAT 0x04000000
68 #define BUTTON_TOUCHPAD 0x08000000
70 #ifdef HAVE_TOUCHPAD
71 #if !defined(BUTTON_TOPLEFT) || !defined(BUTTON_TOPMIDDLE) \
72 || !defined(BUTTON_TOPRIGHT) || !defined(BUTTON_MIDLEFT) \
73 || !defined(BUTTON_CENTER) || !defined(BUTTON_MIDRIGHT) \
74 || !defined(BUTTON_BOTTOMLEFT) || !defined(BUTTON_BOTTOMMIDDLE) \
75 || !defined(BUTTON_BOTTOMRIGHT)
76 #error Touchpad button mode BUTTON_* defines not set up correctly
77 #endif
78 enum touchpad_mode {
79 TOUCHPAD_POINT = 0, /* touchpad returns pixel co-ords */
80 TOUCHPAD_BUTTON, /* touchpad returns BUTTON_* area codes
81 actual pixel value will still be accessable
82 from button_get_data */
84 /* maybe define the number of buttons in button-target.h ? */
85 void touchpad_set_mode(enum touchpad_mode mode);
86 enum touchpad_mode touchpad_get_mode(void);
87 #endif
89 #endif /* _BUTTON_H_ */