You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2023/07/03 13:17:10 UTC
[nuttx] branch master updated: input/touchscreen: Translate raw X/Y data into pixel coordinates
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new e82b762fb7 input/touchscreen: Translate raw X/Y data into pixel coordinates
e82b762fb7 is described below
commit e82b762fb7e276cde121808cd34d575655c6d7d8
Author: Nicolas Caramelli <ca...@gmail.com>
AuthorDate: Mon Jul 3 10:47:50 2023 +0200
input/touchscreen: Translate raw X/Y data into pixel coordinates
---
drivers/input/Kconfig | 16 ++++++++++++++++
drivers/input/stmpe811_tsc.c | 32 ++++++++++++++++++++++++++++++++
include/nuttx/input/touchscreen.h | 12 ++++++++++++
3 files changed, 60 insertions(+)
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index 2998726fa7..9b6421f62f 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -415,6 +415,22 @@ config STMPE811_SWAPXY
---help---
Reverse the meaning of X and Y to handle different LCD orientations.
+config STMPE811_OFFSETX
+ int "X offset"
+ default 0
+ depends on !STMPE811_TSC_DISABLE
+ ---help---
+ Horizontal offset between the left edge of the touchscreen and
+ the left edge of the display area.
+
+config STMPE811_OFFSETY
+ int "Y offset"
+ default 0
+ depends on !STMPE811_TSC_DISABLE
+ ---help---
+ Vertical offset between the top edge of the touchscreen and
+ the top edge of the display area.
+
config STMPE811_THRESHX
int "X threshold"
default 12
diff --git a/drivers/input/stmpe811_tsc.c b/drivers/input/stmpe811_tsc.c
index 9a88393820..364b349499 100644
--- a/drivers/input/stmpe811_tsc.c
+++ b/drivers/input/stmpe811_tsc.c
@@ -573,6 +573,38 @@ static int stmpe811_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
}
break;
+ case TSIOC_GETOFFSETX: /* arg: Pointer to int offsetx config value */
+ {
+ FAR int *ptr = (FAR int *)((uintptr_t)arg);
+ DEBUGASSERT(ptr != NULL);
+ *ptr = CONFIG_STMPE811_OFFSETX;
+ }
+ break;
+
+ case TSIOC_GETOFFSETY: /* arg: Pointer to int offsety config value */
+ {
+ FAR int *ptr = (FAR int *)((uintptr_t)arg);
+ DEBUGASSERT(ptr != NULL);
+ *ptr = CONFIG_STMPE811_OFFSETY;
+ }
+ break;
+
+ case TSIOC_GETTHRESHX: /* arg: Pointer to int threshx config value */
+ {
+ FAR int *ptr = (FAR int *)((uintptr_t)arg);
+ DEBUGASSERT(ptr != NULL);
+ *ptr = CONFIG_STMPE811_THRESHX;
+ }
+ break;
+
+ case TSIOC_GETTHRESHY: /* arg: Pointer to int threshy config value */
+ {
+ FAR int *ptr = (FAR int *)((uintptr_t)arg);
+ DEBUGASSERT(ptr != NULL);
+ *ptr = CONFIG_STMPE811_THRESHY;
+ }
+ break;
+
default:
ret = -ENOTTY;
break;
diff --git a/include/nuttx/input/touchscreen.h b/include/nuttx/input/touchscreen.h
index a14e5850eb..3d6cabaf2b 100644
--- a/include/nuttx/input/touchscreen.h
+++ b/include/nuttx/input/touchscreen.h
@@ -76,6 +76,18 @@
* struct g_tscaldata_s
*/
#define TSIOC_USESCALED _TSIOC(0x0009) /* arg: bool, yes/no */
+#define TSIOC_GETOFFSETX _TSIOC(0x000a) /* arg: Pointer to
+ * int X offset value
+ */
+#define TSIOC_GETOFFSETY _TSIOC(0x000b) /* arg: Pointer to
+ * int Y offset value
+ */
+#define TSIOC_GETTHRESHX _TSIOC(0x000c) /* arg: Pointer to
+ * int X threshold value
+ */
+#define TSIOC_GETTHRESHY _TSIOC(0x000d) /* arg: Pointer to
+ * int Y threshold value
+ */
#define TSC_FIRST 0x0001 /* First common command */
#define TSC_NCMDS 6 /* Six common commands */