summaryrefslogtreecommitdiff
path: root/include/hwdata.h
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-06-16 02:27:32 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-06-16 02:27:32 +0200
commitff88de5cd38b5b51bad0e63d373d66745f1f8d31 (patch)
tree3fbf4adc8c807bc79a8272c4df1623c3677a9b2f /include/hwdata.h
parentad6faf6c53bc1924986e1cc10bb42e5d157cba8f (diff)
refactor: Move files
Move all headers into include, separate source files into modules match, mtdev, src and driver, move some common definitions to common.h, and include define support for the MT slot protocol. This patch does not introduce any logical changes. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'include/hwdata.h')
-rw-r--r--include/hwdata.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/include/hwdata.h b/include/hwdata.h
new file mode 100644
index 0000000..21864dc
--- /dev/null
+++ b/include/hwdata.h
@@ -0,0 +1,75 @@
1/***************************************************************************
2 *
3 * Multitouch X driver
4 * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 **************************************************************************/
21
22#ifndef HWDATA_H
23#define HWDATA_H
24
25#include "common.h"
26#include "button.h"
27
28#define BIT_MT_TOUCH_MAJOR 0
29#define BIT_MT_TOUCH_MINOR 1
30#define BIT_MT_WIDTH_MAJOR 2
31#define BIT_MT_WIDTH_MINOR 3
32#define BIT_MT_ORIENTATION 4
33#define BIT_MT_PRESSURE 5
34#define BIT_MT_POSITION_X 6
35#define BIT_MT_POSITION_Y 7
36#define BIT_MT_CNT 8
37
38struct FingerData {
39 int touch_major, touch_minor;
40 int width_major, width_minor;
41 int orientation, pressure;
42 int position_x, position_y;
43};
44
45/**
46 * struct HWData - hardware reads
47 *
48 * @finger: finger data
49 * @mask: bits corresponding to data actually read (readonly)
50 * @mread: bits corresponding to data in progress (writeonly)
51 * @button: bitmask of buttons
52 * @nfinger: number of fingers actually read (readonly)
53 * @nread: number of fingers in progress (writeonly)
54 *
55 */
56struct HWData {
57 struct FingerData finger[DIM_FINGER];
58 unsigned mask[DIM_FINGER], mread[DIM_FINGER];
59 unsigned button;
60 int nfinger, mtread, nread;
61 mstime_t evtime;
62};
63
64void init_hwdata(struct HWData *hw);
65int read_hwdata(struct HWData *hw, const struct input_event* ev);
66void output_hwdata(const struct HWData *hw);
67
68static inline int finger_dist2(const struct FingerData *a,
69 const struct FingerData *b)
70{
71 return dist2(a->position_x - b->position_x,
72 a->position_y - b->position_y);
73}
74
75#endif