input/touchscreen: Translate raw X/Y data into pixel coordinates

This commit is contained in:
Nicolas Caramelli
2023-07-03 10:47:50 +02:00
committed by Alan Carvalho de Assis
parent de5c35382a
commit e82b762fb7
3 changed files with 60 additions and 0 deletions
+16
View File
@@ -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
+32
View File
@@ -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;