|
@@ -0,0 +1,83 @@
|
|
1
|
+/*
|
|
2
|
+ * This file is subject to the terms of the GFX License. If a copy of
|
|
3
|
+ * the license was not distributed with this file, you can obtain one at:
|
|
4
|
+ *
|
|
5
|
+ * http://ugfx.org/license.html
|
|
6
|
+ */
|
|
7
|
+
|
|
8
|
+#include "gfx.h"
|
|
9
|
+
|
|
10
|
+#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
|
|
11
|
+
|
|
12
|
+#define GMOUSE_DRIVER_VMT GMOUSEVMT_EXC7200
|
|
13
|
+#include "../../../../src/ginput/ginput_driver_mouse.h"
|
|
14
|
+
|
|
15
|
+// Get the hardware interface
|
|
16
|
+#include "gmouse_lld_EXC7200_board.h"
|
|
17
|
+
|
|
18
|
+#define EXC7200_READ_CMD 0x09
|
|
19
|
+
|
|
20
|
+static bool_t MouseInit(GMouse* m, unsigned driverinstance)
|
|
21
|
+{
|
|
22
|
+ if (!init_board(m, driverinstance)) {
|
|
23
|
+ return FALSE;
|
|
24
|
+ }
|
|
25
|
+
|
|
26
|
+ return TRUE;
|
|
27
|
+}
|
|
28
|
+
|
|
29
|
+static bool_t read_xyz(GMouse* m, GMouseReading* pdr)
|
|
30
|
+{
|
|
31
|
+ uint8_t rxbuf[10];
|
|
32
|
+
|
|
33
|
+ // We don't support buttons. This is a regular touchscreen
|
|
34
|
+ pdr->buttons = 0;
|
|
35
|
+
|
|
36
|
+ // Read
|
|
37
|
+ if (!read_bytes(m, EXC7200_READ_CMD, rxbuf, 10)) {
|
|
38
|
+ return FALSE;
|
|
39
|
+ }
|
|
40
|
+
|
|
41
|
+ // Check if touched
|
|
42
|
+ if (rxbuf[1] == 0x83) {
|
|
43
|
+ pdr->x = (((rxbuf[3] & 0x00ff) << 4) | ((rxbuf[2] & 0x00f0) >> 4)) << 1;
|
|
44
|
+ pdr->y = (((rxbuf[5] & 0x00ff) << 4) | ((rxbuf[4] & 0x00f0) >> 4)) << 1;
|
|
45
|
+ pdr->z = 1;
|
|
46
|
+ } else {
|
|
47
|
+ pdr->z = 0;
|
|
48
|
+ }
|
|
49
|
+
|
|
50
|
+ return TRUE;
|
|
51
|
+}
|
|
52
|
+
|
|
53
|
+const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{
|
|
54
|
+ {
|
|
55
|
+ GDRIVER_TYPE_TOUCH,
|
|
56
|
+ GMOUSE_VFLG_TOUCH | GMOUSE_VFLG_ONLY_DOWN | GMOUSE_VFLG_POORUPDOWN | GMOUSE_VFLG_CALIBRATE | GMOUSE_VFLG_CAL_TEST,
|
|
57
|
+ sizeof(GMouse) + GMOUSE_EXC7200_BOARD_DATA_SIZE,
|
|
58
|
+ _gmouseInitDriver,
|
|
59
|
+ _gmousePostInitDriver,
|
|
60
|
+ _gmouseDeInitDriver
|
|
61
|
+ },
|
|
62
|
+ 1, // z_max - not supported
|
|
63
|
+ 0, // z_min - not supported
|
|
64
|
+ 1, // z_touchon
|
|
65
|
+ 0, // z_touchoff
|
|
66
|
+ { // pen_jitter
|
|
67
|
+ GMOUSE_EXC7200_PEN_CALIBRATE_ERROR, // calibrate
|
|
68
|
+ GMOUSE_EXC7200_PEN_CLICK_ERROR, // click
|
|
69
|
+ GMOUSE_EXC7200_PEN_MOVE_ERROR // move
|
|
70
|
+ },
|
|
71
|
+ { // finger_jitter
|
|
72
|
+ GMOUSE_EXC7200_FINGER_CALIBRATE_ERROR, // calibrate
|
|
73
|
+ GMOUSE_EXC7200_FINGER_CLICK_ERROR, // click
|
|
74
|
+ GMOUSE_EXC7200_FINGER_MOVE_ERROR // move
|
|
75
|
+ },
|
|
76
|
+ MouseInit, // init
|
|
77
|
+ 0, // deinit
|
|
78
|
+ read_xyz, // get
|
|
79
|
+ 0, // calsave
|
|
80
|
+ 0 // calload
|
|
81
|
+}};
|
|
82
|
+
|
|
83
|
+#endif /* GFX_USE_GINPUT && GINPUT_NEED_MOUSE */
|