aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@embedded.pro>2016-08-03 02:18:58 +0200
committerJoel Bodenmann <joel@embedded.pro>2016-08-03 02:18:58 +0200
commitc95a851c7769a07484f47d2903a5061c7ee11b4b (patch)
tree5c120e6b6f5272903cc92e64268dfda892c95b72
parent773a5579e06e9fe8a2f466f655d3b4e6a1fcb19d (diff)
downloaduGFX-c95a851c7769a07484f47d2903a5061c7ee11b4b.tar.gz
uGFX-c95a851c7769a07484f47d2903a5061c7ee11b4b.tar.bz2
uGFX-c95a851c7769a07484f47d2903a5061c7ee11b4b.zip
Adding EXC7200 driver
-rw-r--r--docs/releases.txt3
-rw-r--r--drivers/ginput/touch/EXC7200/driver.mk1
-rw-r--r--drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200.c83
-rw-r--r--drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200_board_template.h46
4 files changed, 132 insertions, 1 deletions
diff --git a/docs/releases.txt b/docs/releases.txt
index b6660afd..2b052896 100644
--- a/docs/releases.txt
+++ b/docs/releases.txt
@@ -2,8 +2,9 @@
*** Releases ***
*****************************************************************************
-*** Changes after 2.6 ***
+*** Changes after 2.6 ***
+FEATURE: Added EXC7200 driver
*** Release 2.6 ***
diff --git a/drivers/ginput/touch/EXC7200/driver.mk b/drivers/ginput/touch/EXC7200/driver.mk
new file mode 100644
index 00000000..4239d4fb
--- /dev/null
+++ b/drivers/ginput/touch/EXC7200/driver.mk
@@ -0,0 +1 @@
+GFXSRC += $(GFXLIB)/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200.c
diff --git a/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200.c b/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200.c
new file mode 100644
index 00000000..ebe1d9c8
--- /dev/null
+++ b/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200.c
@@ -0,0 +1,83 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+#include "gfx.h"
+
+#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
+
+#define GMOUSE_DRIVER_VMT GMOUSEVMT_EXC7200
+#include "../../../../src/ginput/ginput_driver_mouse.h"
+
+// Get the hardware interface
+#include "gmouse_lld_EXC7200_board.h"
+
+#define EXC7200_READ_CMD 0x09
+
+static bool_t MouseInit(GMouse* m, unsigned driverinstance)
+{
+ if (!init_board(m, driverinstance)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static bool_t read_xyz(GMouse* m, GMouseReading* pdr)
+{
+ uint8_t rxbuf[10];
+
+ // We don't support buttons. This is a regular touchscreen
+ pdr->buttons = 0;
+
+ // Read
+ if (!read_bytes(m, EXC7200_READ_CMD, rxbuf, 10)) {
+ return FALSE;
+ }
+
+ // Check if touched
+ if (rxbuf[1] == 0x83) {
+ pdr->x = (((rxbuf[3] & 0x00ff) << 4) | ((rxbuf[2] & 0x00f0) >> 4)) << 1;
+ pdr->y = (((rxbuf[5] & 0x00ff) << 4) | ((rxbuf[4] & 0x00f0) >> 4)) << 1;
+ pdr->z = 1;
+ } else {
+ pdr->z = 0;
+ }
+
+ return TRUE;
+}
+
+const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{
+ {
+ GDRIVER_TYPE_TOUCH,
+ GMOUSE_VFLG_TOUCH | GMOUSE_VFLG_ONLY_DOWN | GMOUSE_VFLG_POORUPDOWN | GMOUSE_VFLG_CALIBRATE | GMOUSE_VFLG_CAL_TEST,
+ sizeof(GMouse) + GMOUSE_EXC7200_BOARD_DATA_SIZE,
+ _gmouseInitDriver,
+ _gmousePostInitDriver,
+ _gmouseDeInitDriver
+ },
+ 1, // z_max - not supported
+ 0, // z_min - not supported
+ 1, // z_touchon
+ 0, // z_touchoff
+ { // pen_jitter
+ GMOUSE_EXC7200_PEN_CALIBRATE_ERROR, // calibrate
+ GMOUSE_EXC7200_PEN_CLICK_ERROR, // click
+ GMOUSE_EXC7200_PEN_MOVE_ERROR // move
+ },
+ { // finger_jitter
+ GMOUSE_EXC7200_FINGER_CALIBRATE_ERROR, // calibrate
+ GMOUSE_EXC7200_FINGER_CLICK_ERROR, // click
+ GMOUSE_EXC7200_FINGER_MOVE_ERROR // move
+ },
+ MouseInit, // init
+ 0, // deinit
+ read_xyz, // get
+ 0, // calsave
+ 0 // calload
+}};
+
+#endif /* GFX_USE_GINPUT && GINPUT_NEED_MOUSE */
diff --git a/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200_board_template.h b/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200_board_template.h
new file mode 100644
index 00000000..16588a8a
--- /dev/null
+++ b/drivers/ginput/touch/EXC7200/gmouse_lld_EXC7200_board_template.h
@@ -0,0 +1,46 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+#ifndef _GINPUT_LLD_MOUSE_BOARD_H
+#define _GINPUT_LLD_MOUSE_BOARD_H
+
+// Resolution and Accuracy Settings
+#define GMOUSE_EXC7200_PEN_CALIBRATE_ERROR 8
+#define GMOUSE_EXC7200_PEN_CLICK_ERROR 6
+#define GMOUSE_EXC7200_PEN_MOVE_ERROR 4
+#define GMOUSE_EXC7200_FINGER_CALIBRATE_ERROR 14
+#define GMOUSE_EXC7200_FINGER_CLICK_ERROR 18
+#define GMOUSE_EXC7200_FINGER_MOVE_ERROR 14
+
+// How much extra data to allocate at the end of the GMouse structure for the board's use
+#define GMOUSE_EXC7200_BOARD_DATA_SIZE 0
+
+static bool_t init_board(GMouse* m, unsigned driverinstance)
+{
+}
+
+static GFXINLINE void aquire_bus(GMouse* m)
+{
+}
+
+static GFXINLINE void release_bus(GMouse* m)
+{
+}
+
+static void write_reg(GMouse* m, uint8_t reg, uint8_t val)
+{
+}
+
+static uint8_t read_byte(GMouse* m, uint8_t reg)
+{
+}
+
+static uint16_t read_word(GMouse* m, uint8_t reg)
+{
+}
+
+#endif /* _GINPUT_LLD_MOUSE_BOARD_H */