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 2025/07/07 11:47:04 UTC
(nuttx) branch master updated (27e2f51d2e -> e5b138dee0)
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
from 27e2f51d2e Doc/components: Updare refresh.sh to show usage examples
new 9f6666b75b driver/touchscreen: add custom open/close
new 7cd5d3db72 include: fix typo of touch lowerhalf comment
new ed1384fc81 driver/touchscreen: Add support for mirror/swap
new 770d4a6c86 drivers/input/ft5x06: Adapt to touchscreen frame
new 5671765acd boards: Update configs and params about FT5X06
new e5b138dee0 boards/szpi-esp32s3: Enable touchscreen for LVGL
The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
boards/Kconfig | 2 +-
boards/arm/imxrt/imxrt1060-evk/Kconfig | 4 +
.../arm/imxrt/imxrt1060-evk/configs/lvgl/defconfig | 3 +-
boards/arm/imxrt/imxrt1060-evk/src/imxrt_ft5x06.c | 8 +-
boards/arm/imxrt/imxrt1064-evk/Kconfig | 4 +
.../arm/imxrt/imxrt1064-evk/configs/lvgl/defconfig | 3 +-
boards/arm/imxrt/imxrt1064-evk/src/imxrt_ft5x06.c | 8 +-
boards/arm/lpc54xx/lpcxpresso-lpc54628/Kconfig | 7 +-
.../lpcxpresso-lpc54628/configs/fb/defconfig | 2 +-
.../lpcxpresso-lpc54628/configs/lvgl/defconfig | 2 +-
.../lpcxpresso-lpc54628/configs/nxwm/defconfig | 2 +-
.../lpcxpresso-lpc54628/configs/twm4nx1/defconfig | 2 +-
.../lpcxpresso-lpc54628/configs/twm4nx2/defconfig | 2 +-
.../lpc54xx/lpcxpresso-lpc54628/src/lpc54_ft5x06.c | 8 +-
boards/arm/stm32f7/stm32f746g-disco/Kconfig | 4 +
.../stm32f746g-disco/configs/lvgl/defconfig | 2 +-
.../stm32f746g-disco/src/stm32_touchscreen.c | 8 +-
boards/arm/stm32h7/stm32h745i-disco/Kconfig | 4 +
.../stm32h745i-disco/configs/lvgl/defconfig | 3 +-
.../stm32h745i-disco/configs/touchtest/defconfig | 3 +-
.../stm32h7/stm32h745i-disco/src/stm32_ft5x06.c | 8 +-
boards/arm/stm32h7/stm32h750b-dk/Kconfig | 4 +
.../stm32h7/stm32h750b-dk/configs/lvgl/defconfig | 3 +-
.../arm/stm32h7/stm32h750b-dk/src/stm32_ft5x06.c | 8 +-
boards/xtensa/esp32s3/lckfb-szpi-esp32s3/Kconfig | 18 +
.../lckfb-szpi-esp32s3/configs/lvgl/defconfig | 15 +
.../lckfb-szpi-esp32s3/src/esp32s3_ft5x06.c | 14 +
.../esp32s3/lckfb-szpi-esp32s3/src/etc/init.d/rcS | 4 +
drivers/input/Kconfig | 16 +-
drivers/input/ft5x06.c | 453 ++-------------------
drivers/input/touchscreen_upper.c | 55 ++-
drivers/input/uinput.c | 3 +-
include/nuttx/input/ft5x06.h | 2 +
include/nuttx/input/touchscreen.h | 45 +-
34 files changed, 260 insertions(+), 469 deletions(-)
(nuttx) 05/06: boards: Update configs and params about FT5X06
Posted by ac...@apache.org.
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
commit 5671765acdebd95487b28159276bb345d536056e
Author: wangjianyu3 <wa...@xiaomi.com>
AuthorDate: Sat Jul 5 01:28:17 2025 +0800
boards: Update configs and params about FT5X06
Add touchscreen swap configuration for boards and enable it for defconfig that enables `FT5X06_SWAPXY`.
Refresh configurations to delete the deprecated `FT5X06_NPOLLWAITERS` and `FT5X06_SWAPXY`.
Signed-off-by: wangjianyu3 <wa...@xiaomi.com>
---
boards/Kconfig | 2 +-
boards/arm/imxrt/imxrt1060-evk/Kconfig | 4 ++++
boards/arm/imxrt/imxrt1060-evk/configs/lvgl/defconfig | 3 +--
boards/arm/imxrt/imxrt1060-evk/src/imxrt_ft5x06.c | 8 +++++++-
boards/arm/imxrt/imxrt1064-evk/Kconfig | 4 ++++
boards/arm/imxrt/imxrt1064-evk/configs/lvgl/defconfig | 3 +--
boards/arm/imxrt/imxrt1064-evk/src/imxrt_ft5x06.c | 8 +++++++-
boards/arm/lpc54xx/lpcxpresso-lpc54628/Kconfig | 7 ++++++-
boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/fb/defconfig | 2 +-
boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/lvgl/defconfig | 2 +-
boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/nxwm/defconfig | 2 +-
boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/twm4nx1/defconfig | 2 +-
boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/twm4nx2/defconfig | 2 +-
boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_ft5x06.c | 8 +++++++-
boards/arm/stm32f7/stm32f746g-disco/Kconfig | 4 ++++
boards/arm/stm32f7/stm32f746g-disco/configs/lvgl/defconfig | 2 +-
boards/arm/stm32f7/stm32f746g-disco/src/stm32_touchscreen.c | 8 +++++++-
boards/arm/stm32h7/stm32h745i-disco/Kconfig | 4 ++++
boards/arm/stm32h7/stm32h745i-disco/configs/lvgl/defconfig | 3 +--
boards/arm/stm32h7/stm32h745i-disco/configs/touchtest/defconfig | 3 +--
boards/arm/stm32h7/stm32h745i-disco/src/stm32_ft5x06.c | 8 +++++++-
boards/arm/stm32h7/stm32h750b-dk/Kconfig | 4 ++++
boards/arm/stm32h7/stm32h750b-dk/configs/lvgl/defconfig | 3 +--
boards/arm/stm32h7/stm32h750b-dk/src/stm32_ft5x06.c | 8 +++++++-
24 files changed, 80 insertions(+), 24 deletions(-)
diff --git a/boards/Kconfig b/boards/Kconfig
index 13ca936f4c..6b1bbfdac7 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -4327,7 +4327,7 @@ endif
if ARCH_BOARD_STM32H745I_DISCO
source "boards/arm/stm32h7/stm32h745i-disco/Kconfig"
endif
-if ARCH_BOARD_STM32H750B_DB
+if ARCH_BOARD_STM32H750B_DK
source "boards/arm/stm32h7/stm32h750b-dk/Kconfig"
endif
if ARCH_BOARD_LINUM_STM32H753BI
diff --git a/boards/arm/imxrt/imxrt1060-evk/Kconfig b/boards/arm/imxrt/imxrt1060-evk/Kconfig
index e84ad2c14c..2c88b42db5 100644
--- a/boards/arm/imxrt/imxrt1060-evk/Kconfig
+++ b/boards/arm/imxrt/imxrt1060-evk/Kconfig
@@ -17,4 +17,8 @@ config IMXRT1060_EVK_QSPI_FLASH
endchoice # Boot Flash
+config IMXRT1060_EVK_TOUCHSCREEN_SWAPXY
+ bool "IMXRT1060 EVK Touchscreen sway X/Y"
+ depends on INPUT_TOUCHSCREEN
+
endif
diff --git a/boards/arm/imxrt/imxrt1060-evk/configs/lvgl/defconfig b/boards/arm/imxrt/imxrt1060-evk/configs/lvgl/defconfig
index e22eb8917c..91aed44ff7 100644
--- a/boards/arm/imxrt/imxrt1060-evk/configs/lvgl/defconfig
+++ b/boards/arm/imxrt/imxrt1060-evk/configs/lvgl/defconfig
@@ -21,14 +21,13 @@ CONFIG_BUILTIN=y
CONFIG_DRIVERS_VIDEO=y
CONFIG_EXAMPLES_LVGLDEMO=y
CONFIG_FS_PROCFS=y
-CONFIG_FT5X06_NPOLLWAITERS=8
CONFIG_FT5X06_POLLMODE=y
CONFIG_FT5X06_SINGLEPOINT=y
-CONFIG_FT5X06_SWAPXY=y
CONFIG_FT5X06_THRESHX=9
CONFIG_FT5X06_THRESHY=15
CONFIG_GRAPHICS_LVGL=y
CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_IMXRT1060_EVK_TOUCHSCREEN_SWAPXY=y
CONFIG_IMXRT_GPIO1_0_15_IRQ=y
CONFIG_IMXRT_GPIO_IRQ=y
CONFIG_IMXRT_LCD=y
diff --git a/boards/arm/imxrt/imxrt1060-evk/src/imxrt_ft5x06.c b/boards/arm/imxrt/imxrt1060-evk/src/imxrt_ft5x06.c
index d3b0a9ce0f..5bbf489fb6 100644
--- a/boards/arm/imxrt/imxrt1060-evk/src/imxrt_ft5x06.c
+++ b/boards/arm/imxrt/imxrt1060-evk/src/imxrt_ft5x06.c
@@ -80,7 +80,13 @@ static const struct ft5x06_config_s g_ft5x06_config =
.clear = imxrt_ft5x06_clear,
#endif
.wakeup = imxrt_ft5x06_wakeup,
- .nreset = imxrt_ft5x06_nreset
+ .nreset = imxrt_ft5x06_nreset,
+ .lower =
+ {
+#ifdef CONFIG_IMXRT1060_EVK_TOUCHSCREEN_SWAPXY
+ .flags = TOUCH_FLAG_SWAPXY,
+#endif
+ },
};
#ifndef CONFIG_FT5X06_POLLMODE
diff --git a/boards/arm/imxrt/imxrt1064-evk/Kconfig b/boards/arm/imxrt/imxrt1064-evk/Kconfig
index 119d7a772d..42e552f910 100644
--- a/boards/arm/imxrt/imxrt1064-evk/Kconfig
+++ b/boards/arm/imxrt/imxrt1064-evk/Kconfig
@@ -24,4 +24,8 @@ config IMXRT1064_EVK_SDRAM
---help---
Activate DCD configuration of SDRAM
+config IMXRT1064_EVK_TOUCHSCREEN_SWAPXY
+ bool "IMXRT1064 EVK Touchscreen sway X/Y"
+ depends on INPUT_TOUCHSCREEN
+
endif
diff --git a/boards/arm/imxrt/imxrt1064-evk/configs/lvgl/defconfig b/boards/arm/imxrt/imxrt1064-evk/configs/lvgl/defconfig
index 985b3240f1..58de0530bb 100644
--- a/boards/arm/imxrt/imxrt1064-evk/configs/lvgl/defconfig
+++ b/boards/arm/imxrt/imxrt1064-evk/configs/lvgl/defconfig
@@ -21,14 +21,13 @@ CONFIG_BUILTIN=y
CONFIG_DRIVERS_VIDEO=y
CONFIG_EXAMPLES_LVGLDEMO=y
CONFIG_FS_PROCFS=y
-CONFIG_FT5X06_NPOLLWAITERS=8
CONFIG_FT5X06_POLLMODE=y
CONFIG_FT5X06_SINGLEPOINT=y
-CONFIG_FT5X06_SWAPXY=y
CONFIG_FT5X06_THRESHX=9
CONFIG_FT5X06_THRESHY=15
CONFIG_GRAPHICS_LVGL=y
CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_IMXRT1064_EVK_TOUCHSCREEN_SWAPXY=y
CONFIG_IMXRT_EDMA=y
CONFIG_IMXRT_GPIO1_0_15_IRQ=y
CONFIG_IMXRT_GPIO_IRQ=y
diff --git a/boards/arm/imxrt/imxrt1064-evk/src/imxrt_ft5x06.c b/boards/arm/imxrt/imxrt1064-evk/src/imxrt_ft5x06.c
index bb49d1ad62..588dcaa263 100644
--- a/boards/arm/imxrt/imxrt1064-evk/src/imxrt_ft5x06.c
+++ b/boards/arm/imxrt/imxrt1064-evk/src/imxrt_ft5x06.c
@@ -80,7 +80,13 @@ static const struct ft5x06_config_s g_ft5x06_config =
.clear = imxrt_ft5x06_clear,
#endif
.wakeup = imxrt_ft5x06_wakeup,
- .nreset = imxrt_ft5x06_nreset
+ .nreset = imxrt_ft5x06_nreset,
+ .lower =
+ {
+#ifdef CONFIG_IMXRT1064_EVK_TOUCHSCREEN_SWAPXY
+ .flags = TOUCH_FLAG_SWAPXY,
+#endif
+ },
};
#ifndef CONFIG_FT5X06_POLLMODE
diff --git a/boards/arm/lpc54xx/lpcxpresso-lpc54628/Kconfig b/boards/arm/lpc54xx/lpcxpresso-lpc54628/Kconfig
index fba3ae0dc1..59d3eb737e 100644
--- a/boards/arm/lpc54xx/lpcxpresso-lpc54628/Kconfig
+++ b/boards/arm/lpc54xx/lpcxpresso-lpc54628/Kconfig
@@ -3,5 +3,10 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
-if ARCH_BOARD_LPCXPRESSO
+if ARCH_BOARD_LPCXPRESSO_LPC54628
+
+config ARCH_BOARD_LPCXPRESSO_LPC54628_TOUCHSCREEN_SWAPXY
+ bool "LPCXPRESSO LPC54628 Touchscreen sway X/Y"
+ depends on INPUT_TOUCHSCREEN
+
endif
diff --git a/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/fb/defconfig b/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/fb/defconfig
index 584e9aaae5..31fdf4303f 100644
--- a/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/fb/defconfig
+++ b/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/fb/defconfig
@@ -9,6 +9,7 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="lpcxpresso-lpc54628"
CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y
+CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628_TOUCHSCREEN_SWAPXY=y
CONFIG_ARCH_CHIP="lpc54xx"
CONFIG_ARCH_CHIP_LPC54628=y
CONFIG_ARCH_CHIP_LPC54XX=y
@@ -27,7 +28,6 @@ CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_FT5X06_POLLMODE=y
CONFIG_FT5X06_SINGLEPOINT=y
-CONFIG_FT5X06_SWAPXY=y
CONFIG_GRAPHICS_PDCURSES=y
CONFIG_I2CTOOL_MAXBUS=9
CONFIG_INIT_ENTRYPOINT="nsh_main"
diff --git a/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/lvgl/defconfig b/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/lvgl/defconfig
index 514e39cd3b..ed6324f1f1 100644
--- a/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/lvgl/defconfig
+++ b/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/lvgl/defconfig
@@ -10,6 +10,7 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="lpcxpresso-lpc54628"
CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y
+CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628_TOUCHSCREEN_SWAPXY=y
CONFIG_ARCH_CHIP="lpc54xx"
CONFIG_ARCH_CHIP_LPC54628=y
CONFIG_ARCH_CHIP_LPC54XX=y
@@ -24,7 +25,6 @@ CONFIG_EXAMPLES_LVGLDEMO=y
CONFIG_FS_PROCFS=y
CONFIG_FT5X06_POLLMODE=y
CONFIG_FT5X06_SINGLEPOINT=y
-CONFIG_FT5X06_SWAPXY=y
CONFIG_GRAPHICS_LVGL=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
diff --git a/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/nxwm/defconfig b/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/nxwm/defconfig
index 8508aedabc..a74fabf0b3 100644
--- a/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/nxwm/defconfig
+++ b/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/nxwm/defconfig
@@ -12,6 +12,7 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="lpcxpresso-lpc54628"
CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y
+CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628_TOUCHSCREEN_SWAPXY=y
CONFIG_ARCH_CHIP="lpc54xx"
CONFIG_ARCH_CHIP_LPC54628=y
CONFIG_ARCH_CHIP_LPC54XX=y
@@ -26,7 +27,6 @@ CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_FT5X06_POLLMODE=y
CONFIG_FT5X06_SINGLEPOINT=y
-CONFIG_FT5X06_SWAPXY=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_INIT_ENTRYPOINT="nxwm_main"
diff --git a/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/twm4nx1/defconfig b/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/twm4nx1/defconfig
index f9925d1278..8a20380501 100644
--- a/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/twm4nx1/defconfig
+++ b/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/twm4nx1/defconfig
@@ -12,6 +12,7 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="lpcxpresso-lpc54628"
CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y
+CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628_TOUCHSCREEN_SWAPXY=y
CONFIG_ARCH_CHIP="lpc54xx"
CONFIG_ARCH_CHIP_LPC54628=y
CONFIG_ARCH_CHIP_LPC54XX=y
@@ -23,7 +24,6 @@ CONFIG_EXPERIMENTAL=y
CONFIG_FS_PROCFS=y
CONFIG_FT5X06_POLLMODE=y
CONFIG_FT5X06_SINGLEPOINT=y
-CONFIG_FT5X06_SWAPXY=y
CONFIG_FT5X06_THRESHX=8
CONFIG_FT5X06_THRESHY=8
CONFIG_GRAPHICS_TWM4NX=y
diff --git a/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/twm4nx2/defconfig b/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/twm4nx2/defconfig
index 3bd0c8804e..7c9172c2ab 100644
--- a/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/twm4nx2/defconfig
+++ b/boards/arm/lpc54xx/lpcxpresso-lpc54628/configs/twm4nx2/defconfig
@@ -12,6 +12,7 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="lpcxpresso-lpc54628"
CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y
+CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628_TOUCHSCREEN_SWAPXY=y
CONFIG_ARCH_CHIP="lpc54xx"
CONFIG_ARCH_CHIP_LPC54628=y
CONFIG_ARCH_CHIP_LPC54XX=y
@@ -23,7 +24,6 @@ CONFIG_EXPERIMENTAL=y
CONFIG_FS_PROCFS=y
CONFIG_FT5X06_POLLMODE=y
CONFIG_FT5X06_SINGLEPOINT=y
-CONFIG_FT5X06_SWAPXY=y
CONFIG_FT5X06_THRESHX=8
CONFIG_FT5X06_THRESHY=8
CONFIG_GRAPHICS_TWM4NX=y
diff --git a/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_ft5x06.c b/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_ft5x06.c
index 02bcacf6c2..ffd3bda91a 100644
--- a/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_ft5x06.c
+++ b/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_ft5x06.c
@@ -76,7 +76,13 @@ static const struct ft5x06_config_s g_ft5x06_config =
.clear = lpc54_ft5x06_clear,
#endif
.wakeup = lpc54_ft5x06_wakeup,
- .nreset = lpc54_ft5x06_nreset
+ .nreset = lpc54_ft5x06_nreset,
+ .lower =
+ {
+#ifdef CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628_TOUCHSCREEN_SWAPXY
+ .flags = TOUCH_FLAG_SWAPXY,
+#endif
+ },
};
#ifndef CONFIG_FT5X06_POLLMODE
diff --git a/boards/arm/stm32f7/stm32f746g-disco/Kconfig b/boards/arm/stm32f7/stm32f746g-disco/Kconfig
index 24d699d9cf..40785710b6 100644
--- a/boards/arm/stm32f7/stm32f746g-disco/Kconfig
+++ b/boards/arm/stm32f7/stm32f746g-disco/Kconfig
@@ -17,4 +17,8 @@ config STM32F746GDISCO_FLASH
---help---
Configures an MTD device for use with the onboard flash
+config STM32F746GDISCO_TOUCHSCREEN_SWAPXY
+ bool "STM32F746G DISCO Touchscreen sway X/Y"
+ depends on INPUT_TOUCHSCREEN
+
endif # ARCH_BOARD_STM32F746G_DISCO
diff --git a/boards/arm/stm32f7/stm32f746g-disco/configs/lvgl/defconfig b/boards/arm/stm32f7/stm32f746g-disco/configs/lvgl/defconfig
index 97f99c32b5..b5be48bd47 100644
--- a/boards/arm/stm32f7/stm32f746g-disco/configs/lvgl/defconfig
+++ b/boards/arm/stm32f7/stm32f746g-disco/configs/lvgl/defconfig
@@ -34,7 +34,6 @@ CONFIG_EXAMPLES_FB=y
CONFIG_EXAMPLES_LVGLDEMO=y
CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_FT5X06_SINGLEPOINT=y
-CONFIG_FT5X06_SWAPXY=y
CONFIG_GRAPHICS_LVGL=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
@@ -61,6 +60,7 @@ CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_WAITPID=y
+CONFIG_STM32F746GDISCO_TOUCHSCREEN_SWAPXY=y
CONFIG_STM32F7_FMC=y
CONFIG_STM32F7_I2C3=y
CONFIG_STM32F7_LTDC=y
diff --git a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_touchscreen.c b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_touchscreen.c
index 17153bc48e..94b43bd981 100644
--- a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_touchscreen.c
+++ b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_touchscreen.c
@@ -103,7 +103,13 @@ static const struct ft5x06_config_s g_ft5x06_config =
.clear = stm32_ft5x06_clear,
#endif
.wakeup = stm32_ft5x06_wakeup,
- .nreset = stm32_ft5x06_nreset
+ .nreset = stm32_ft5x06_nreset,
+ .lower =
+ {
+#ifdef CONFIG_STM32F746GDISCO_TOUCHSCREEN_SWAPXY
+ .flags = TOUCH_FLAG_SWAPXY,
+#endif
+ },
};
static struct stm32_ft5x06_config_s g_priv_config =
diff --git a/boards/arm/stm32h7/stm32h745i-disco/Kconfig b/boards/arm/stm32h7/stm32h745i-disco/Kconfig
index d850d66e8c..a6c7642bf0 100644
--- a/boards/arm/stm32h7/stm32h745i-disco/Kconfig
+++ b/boards/arm/stm32h7/stm32h745i-disco/Kconfig
@@ -5,4 +5,8 @@
if ARCH_BOARD_STM32H745I_DISCO
+config ARCH_BOARD_STM32H745I_DISCO_TOUCHSCREEN_SWAPXY
+ bool "STM32H745I DISCO Touchscreen sway X/Y"
+ depends on INPUT_TOUCHSCREEN
+
endif # ARCH_BOARD_STM32H745I_DISCO
diff --git a/boards/arm/stm32h7/stm32h745i-disco/configs/lvgl/defconfig b/boards/arm/stm32h7/stm32h745i-disco/configs/lvgl/defconfig
index 566892360f..8479594746 100644
--- a/boards/arm/stm32h7/stm32h745i-disco/configs/lvgl/defconfig
+++ b/boards/arm/stm32h7/stm32h745i-disco/configs/lvgl/defconfig
@@ -14,6 +14,7 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32h745i-disco"
CONFIG_ARCH_BOARD_STM32H745I_DISCO=y
+CONFIG_ARCH_BOARD_STM32H745I_DISCO_TOUCHSCREEN_SWAPXY=y
CONFIG_ARCH_CHIP="stm32h7"
CONFIG_ARCH_CHIP_STM32H745XI=y
CONFIG_ARCH_CHIP_STM32H7=y
@@ -31,10 +32,8 @@ CONFIG_EXAMPLES_FB=y
CONFIG_EXAMPLES_LVGLDEMO=y
CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_FS_PROCFS=y
-CONFIG_FT5X06_NPOLLWAITERS=8
CONFIG_FT5X06_POLLMODE=y
CONFIG_FT5X06_SINGLEPOINT=y
-CONFIG_FT5X06_SWAPXY=y
CONFIG_FT5X06_THRESHX=9
CONFIG_FT5X06_THRESHY=15
CONFIG_GRAPHICS_LVGL=y
diff --git a/boards/arm/stm32h7/stm32h745i-disco/configs/touchtest/defconfig b/boards/arm/stm32h7/stm32h745i-disco/configs/touchtest/defconfig
index 62364e7e24..6a180d605e 100644
--- a/boards/arm/stm32h7/stm32h745i-disco/configs/touchtest/defconfig
+++ b/boards/arm/stm32h7/stm32h745i-disco/configs/touchtest/defconfig
@@ -11,6 +11,7 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32h745i-disco"
CONFIG_ARCH_BOARD_STM32H745I_DISCO=y
+CONFIG_ARCH_BOARD_STM32H745I_DISCO_TOUCHSCREEN_SWAPXY=y
CONFIG_ARCH_CHIP="stm32h7"
CONFIG_ARCH_CHIP_STM32H745XI=y
CONFIG_ARCH_CHIP_STM32H7=y
@@ -24,10 +25,8 @@ CONFIG_BOARD_LOOPSPERMSEC=43103
CONFIG_BUILTIN=y
CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_FS_PROCFS=y
-CONFIG_FT5X06_NPOLLWAITERS=8
CONFIG_FT5X06_POLLMODE=y
CONFIG_FT5X06_SINGLEPOINT=y
-CONFIG_FT5X06_SWAPXY=y
CONFIG_FT5X06_THRESHX=9
CONFIG_FT5X06_THRESHY=15
CONFIG_INIT_ENTRYPOINT="nsh_main"
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_ft5x06.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_ft5x06.c
index 1c77b3d194..97c65c5a65 100644
--- a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_ft5x06.c
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_ft5x06.c
@@ -104,7 +104,13 @@ static const struct ft5x06_config_s g_ft5x06_config =
.clear = stm32_ft5x06_clear,
#endif
.wakeup = stm32_ft5x06_wakeup,
- .nreset = stm32_ft5x06_nreset
+ .nreset = stm32_ft5x06_nreset,
+ .lower =
+ {
+#ifdef CONFIG_ARCH_BOARD_STM32H745I_DISCO_TOUCHSCREEN_SWAPXY
+ .flags = TOUCH_FLAG_SWAPXY,
+#endif
+ },
};
#ifndef CONFIG_FT5X06_POLLMODE
diff --git a/boards/arm/stm32h7/stm32h750b-dk/Kconfig b/boards/arm/stm32h7/stm32h750b-dk/Kconfig
index 68542f0f61..9b4de6f4bd 100644
--- a/boards/arm/stm32h7/stm32h750b-dk/Kconfig
+++ b/boards/arm/stm32h7/stm32h750b-dk/Kconfig
@@ -5,4 +5,8 @@
if ARCH_BOARD_STM32H750B_DK
+config ARCH_BOARD_STM32H750B_DK_TOUCHSCREEN_SWAPXY
+ bool "STM32H750B DK Touchscreen sway X/Y"
+ depends on INPUT_TOUCHSCREEN
+
endif # ARCH_BOARD_STM32H750B_DK
diff --git a/boards/arm/stm32h7/stm32h750b-dk/configs/lvgl/defconfig b/boards/arm/stm32h7/stm32h750b-dk/configs/lvgl/defconfig
index 5ba22bfab6..96da5dc884 100644
--- a/boards/arm/stm32h7/stm32h750b-dk/configs/lvgl/defconfig
+++ b/boards/arm/stm32h7/stm32h750b-dk/configs/lvgl/defconfig
@@ -14,6 +14,7 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32h750b-dk"
CONFIG_ARCH_BOARD_STM32H750B_DK=y
+CONFIG_ARCH_BOARD_STM32H750B_DK_TOUCHSCREEN_SWAPXY=y
CONFIG_ARCH_CHIP="stm32h7"
CONFIG_ARCH_CHIP_STM32H750B=y
CONFIG_ARCH_CHIP_STM32H7=y
@@ -32,10 +33,8 @@ CONFIG_EXAMPLES_FB=y
CONFIG_EXAMPLES_LVGLDEMO=y
CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_FS_PROCFS=y
-CONFIG_FT5X06_NPOLLWAITERS=8
CONFIG_FT5X06_POLLMODE=y
CONFIG_FT5X06_SINGLEPOINT=y
-CONFIG_FT5X06_SWAPXY=y
CONFIG_FT5X06_THRESHX=9
CONFIG_FT5X06_THRESHY=15
CONFIG_GRAPHICS_LVGL=y
diff --git a/boards/arm/stm32h7/stm32h750b-dk/src/stm32_ft5x06.c b/boards/arm/stm32h7/stm32h750b-dk/src/stm32_ft5x06.c
index 3cedc84a39..60c33e8bda 100644
--- a/boards/arm/stm32h7/stm32h750b-dk/src/stm32_ft5x06.c
+++ b/boards/arm/stm32h7/stm32h750b-dk/src/stm32_ft5x06.c
@@ -102,7 +102,13 @@ static const struct ft5x06_config_s g_ft5x06_config =
.clear = stm32_ft5x06_clear,
#endif
.wakeup = stm32_ft5x06_wakeup,
- .nreset = stm32_ft5x06_nreset
+ .nreset = stm32_ft5x06_nreset,
+ .lower =
+ {
+#ifdef CONFIG_ARCH_BOARD_STM32H750B_DK_TOUCHSCREEN_SWAPXY
+ .flags = TOUCH_FLAG_SWAPXY,
+#endif
+ },
};
#ifndef CONFIG_FT5X06_POLLMODE
(nuttx) 03/06: driver/touchscreen: Add support for mirror/swap
Posted by ac...@apache.org.
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
commit ed1384fc8104e664c4d795542dcdf634ca5fa5cb
Author: wangjianyu3 <wa...@xiaomi.com>
AuthorDate: Sat Jul 5 00:06:23 2025 +0800
driver/touchscreen: Add support for mirror/swap
Add support for mirror/swap coordinates.
There are some touchscreen drivers not support mirror or swap coordinates.
For example, drivers/input/ft5x06 does not support mirror.
Signed-off-by: wangjianyu3 <wa...@xiaomi.com>
---
drivers/input/touchscreen_upper.c | 44 ++++++++++++++++++++++++++++++---------
drivers/input/uinput.c | 3 +--
include/nuttx/input/touchscreen.h | 13 +++++++++++-
3 files changed, 47 insertions(+), 13 deletions(-)
diff --git a/drivers/input/touchscreen_upper.c b/drivers/input/touchscreen_upper.c
index 9afcfcc82f..a8e110b8ec 100644
--- a/drivers/input/touchscreen_upper.c
+++ b/drivers/input/touchscreen_upper.c
@@ -81,8 +81,9 @@ static int touch_ioctl(FAR struct file *filep, int cmd,
static int touch_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup);
-static void touch_event_notify(FAR struct touch_openpriv_s *openpriv,
- FAR const struct touch_sample_s *sample);
+static void touch_event_notify(FAR struct touch_upperhalf_s *upper,
+ FAR struct touch_openpriv_s *openpriv,
+ FAR struct touch_sample_s *sample);
/****************************************************************************
* Private Data
@@ -384,17 +385,40 @@ errout:
* Name: touch_event_notify
****************************************************************************/
-static void touch_event_notify(FAR struct touch_openpriv_s *openpriv,
- FAR const struct touch_sample_s *sample)
+static void touch_event_notify(FAR struct touch_upperhalf_s *upper,
+ FAR struct touch_openpriv_s *openpriv,
+ FAR struct touch_sample_s *sample)
{
- int semcount;
+ FAR struct touch_lowerhalf_s *lower = upper->lower;
+ FAR struct touch_point_s *point = sample->point;
+ int n;
+
+ for (n = 0; lower->flags && n < sample->npoints; n++)
+ {
+ if (lower->flags & TOUCH_FLAG_SWAPXY)
+ {
+ int16_t p = point[n].x;
+ point[n].x = point[n].y;
+ point[n].y = p;
+ }
+
+ if (lower->flags & TOUCH_FLAG_MIRRORX)
+ {
+ point[n].x = upper->lower->xres - point[n].x;
+ }
+
+ if (lower->flags & TOUCH_FLAG_MIRRORY)
+ {
+ point[n].y = upper->lower->yres - point[n].y;
+ }
+ }
nxmutex_lock(&openpriv->lock);
circbuf_overwrite(&openpriv->circbuf, sample,
SIZEOF_TOUCH_SAMPLE_S(sample->npoints));
- nxsem_get_value(&openpriv->waitsem, &semcount);
- if (semcount < 1)
+ nxsem_get_value(&openpriv->waitsem, &n);
+ if (n < 1)
{
nxsem_post(&openpriv->waitsem);
}
@@ -411,7 +435,7 @@ static void touch_event_notify(FAR struct touch_openpriv_s *openpriv,
* Name: touch_event
****************************************************************************/
-void touch_event(FAR void *priv, FAR const struct touch_sample_s *sample)
+void touch_event(FAR void *priv, FAR struct touch_sample_s *sample)
{
FAR struct touch_upperhalf_s *upper = priv;
FAR struct touch_openpriv_s *openpriv;
@@ -423,14 +447,14 @@ void touch_event(FAR void *priv, FAR const struct touch_sample_s *sample)
if (upper->grab)
{
- touch_event_notify(upper->grab, sample);
+ touch_event_notify(upper, upper->grab, sample);
}
else
{
list_for_every_entry(&upper->head, openpriv,
struct touch_openpriv_s, node)
{
- touch_event_notify(openpriv, sample);
+ touch_event_notify(upper, openpriv, sample);
}
}
diff --git a/drivers/input/uinput.c b/drivers/input/uinput.c
index 406ef65627..bb3cfb8cdf 100644
--- a/drivers/input/uinput.c
+++ b/drivers/input/uinput.c
@@ -309,8 +309,7 @@ static ssize_t uinput_touch_notify(FAR void *uinput_lower,
{
FAR struct uinput_touch_lowerhalf_s *utcs_lower =
(FAR struct uinput_touch_lowerhalf_s *)uinput_lower;
- FAR const struct touch_sample_s *sample =
- (FAR const struct touch_sample_s *)buffer;
+ FAR struct touch_sample_s *sample = (FAR struct touch_sample_s *)buffer;
touch_event(utcs_lower->lower.priv, sample);
return buflen;
diff --git a/include/nuttx/input/touchscreen.h b/include/nuttx/input/touchscreen.h
index f93a4eb300..16052a3e61 100644
--- a/include/nuttx/input/touchscreen.h
+++ b/include/nuttx/input/touchscreen.h
@@ -141,6 +141,14 @@
#define TOUCH_SIZE_VALID (1 << 6) /* Hardware provided a valid H/W contact size */
#define TOUCH_GESTURE_VALID (1 << 7) /* Hardware provided a valid gesture */
+/* These definitions provide the meaning of all of the bits that may be
+ * reported in the struct touch_lowerhalf_s flags.
+ */
+
+#define TOUCH_FLAG_SWAPXY (1 << 0) /* Swap the X and Y coordinates */
+#define TOUCH_FLAG_MIRRORX (1 << 1) /* Mirror X coordinate */
+#define TOUCH_FLAG_MIRRORY (1 << 2) /* Mirror Y coordinate */
+
/* These are definitions for touch gesture */
#define TOUCH_DOUBLE_CLICK (0x00)
@@ -234,6 +242,9 @@ struct touch_sample_s
struct touch_lowerhalf_s
{
uint8_t maxpoint; /* Maximal point supported by the touchscreen */
+ uint8_t flags; /* Flags for rotation, see TOUCH_FLAG_* */
+ uint16_t xres; /* Horizontal resolution in pixels */
+ uint16_t yres; /* Vertical resolution in pixels */
FAR void *priv; /* Save the upper half pointer */
/**************************************************************************
@@ -333,7 +344,7 @@ static inline uint64_t touch_get_time(void)
* sample - pointer to data of touch point event.
****************************************************************************/
-void touch_event(FAR void *priv, FAR const struct touch_sample_s *sample);
+void touch_event(FAR void *priv, FAR struct touch_sample_s *sample);
/****************************************************************************
* Name: touch_register
(nuttx) 04/06: drivers/input/ft5x06: Adapt to touchscreen frame
Posted by ac...@apache.org.
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
commit 770d4a6c868e22989c1f5365d8f646e661136204
Author: wangjianyu3 <wa...@xiaomi.com>
AuthorDate: Sat Jul 5 00:36:05 2025 +0800
drivers/input/ft5x06: Adapt to touchscreen frame
Calling touch_register() to register touchscreen driver instead of
registering generic driver.
Signed-off-by: wangjianyu3 <wa...@xiaomi.com>
---
drivers/input/Kconfig | 16 +-
drivers/input/ft5x06.c | 453 ++++---------------------------------------
include/nuttx/input/ft5x06.h | 2 +
3 files changed, 40 insertions(+), 431 deletions(-)
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index 959b9e0cda..47b861b739 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -218,12 +218,6 @@ config FT5X06_POLLMODE
in detecting touch related events and (2) it will consume a
significant amount of CPU time to perform the polling.
-config FT5X06_SWAPXY
- bool "Swap X/Y"
- default n
- ---help---
- Reverse the meaning of X and Y to handle different LCD orientations.
-
config FT5X06_SINGLEPOINT
bool "Single point"
default n
@@ -252,11 +246,11 @@ config FT5X06_THRESHY
endif # FT5X06_SINGLEPOINT
-config FT5X06_NPOLLWAITERS
- int "Number FT5336/FT5x06 poll waiters"
- default 4
- ---help---
- Maximum number of threads that can be waiting on poll()
+config FT5X06_SAMPLE_NBUFFER
+ int "Number FT5336/FT5x06 sample buffers"
+ default 4
+ ---help---
+ Maximum number of samples buffered.
endif # INPUT_FT5X06
diff --git a/drivers/input/ft5x06.c b/drivers/input/ft5x06.c
index 0af7e41c51..f5d7e31b8d 100644
--- a/drivers/input/ft5x06.c
+++ b/drivers/input/ft5x06.c
@@ -97,10 +97,7 @@
struct ft5x06_dev_s
{
- uint8_t crefs; /* Number of times the device
- * has been opened */
- uint8_t nwaiters; /* Number of threads waiting for
- * FT5x06 data */
+ struct ft5x06_config_s config; /* Board configuration data */
volatile bool valid; /* True: New, valid touch data
* in touchbuf[] */
#ifdef CONFIG_FT5X06_SINGLEPOINT
@@ -111,14 +108,11 @@ struct ft5x06_dev_s
#endif
mutex_t devlock; /* Manages exclusive access to
* this structure */
- sem_t waitsem; /* Used to wait for the
- * availability of data */
uint32_t frequency; /* Current I2C frequency */
#ifdef CONFIG_FT5X06_POLLMODE
uint32_t delay; /* Current poll delay */
#endif
- FAR const struct ft5x06_config_s *config; /* Board configuration data */
FAR struct i2c_master_s *i2c; /* Saved I2C driver instance */
struct work_s work; /* Supports the interrupt
* handling "bottom half" */
@@ -126,13 +120,6 @@ struct ft5x06_dev_s
struct wdog_s polltimer; /* Poll timer */
#endif
uint8_t touchbuf[FT5X06_TOUCH_DATA_LEN]; /* Raw touch data */
-
- /* The following is a list if poll structures of threads waiting for
- * driver events. The 'struct pollfd' reference for each open is also
- * retained in the f_priv field of the 'struct file'.
- */
-
- FAR struct pollfd *fds[CONFIG_FT5X06_NPOLLWAITERS];
};
/****************************************************************************
@@ -148,41 +135,15 @@ static int ft5x06_data_interrupt(int irq, FAR void *context, FAR void *arg);
#endif
static ssize_t ft5x06_sample(FAR struct ft5x06_dev_s *priv, FAR char *buffer,
size_t len);
-static ssize_t ft5x06_waitsample(FAR struct ft5x06_dev_s *priv,
- FAR char *buffer, size_t len);
-static int ft5x06_bringup(FAR struct ft5x06_dev_s *priv);
-static void ft5x06_shutdown(FAR struct ft5x06_dev_s *priv);
-
-/* Character driver methods */
-
-static int ft5x06_open(FAR struct file *filep);
-static int ft5x06_close(FAR struct file *filep);
-static ssize_t ft5x06_read(FAR struct file *filep, FAR char *buffer,
- size_t len);
-static int ft5x06_ioctl(FAR struct file *filep, int cmd,
+static int ft5x06_bringup(FAR struct touch_lowerhalf_s *lower);
+static int ft5x06_shutdown(FAR struct touch_lowerhalf_s *lower);
+static int ft5x06_ioctl(FAR struct touch_lowerhalf_s *lower, int cmd,
unsigned long arg);
-static int ft5x06_poll(FAR struct file *filep, FAR struct pollfd *fds,
- bool setup);
/****************************************************************************
* Private Data
****************************************************************************/
-/* This the vtable that supports the character driver interface */
-
-static const struct file_operations g_ft5x06_fops =
-{
- ft5x06_open, /* open */
- ft5x06_close, /* close */
- ft5x06_read, /* read */
- NULL, /* write */
- NULL, /* seek */
- ft5x06_ioctl, /* ioctl */
- NULL, /* mmap */
- NULL, /* truncate */
- ft5x06_poll /* poll */
-};
-
/* Maps FT5x06 touch events into bit encoded representation used by NuttX */
static const uint8_t g_event_map[4] =
@@ -203,25 +164,12 @@ static const uint8_t g_event_map[4] =
static void ft5x06_notify(FAR struct ft5x06_dev_s *priv)
{
- /* If there are threads waiting on poll() for FT5x06 data to become
- * available, then wake them up now. NOTE: we wake up all waiting threads
- * because we do not know that they are going to do. If they all try to
- * read the data, then some make end up blocking after all.
- */
-
- poll_notify(priv->fds, CONFIG_FT5X06_NPOLLWAITERS, POLLIN);
-
- /* If there are threads waiting for read data, then signal one of them
- * that the read data is available.
- */
+ struct touch_sample_s sample;
- if (priv->nwaiters > 0)
+ memset(&sample, 0, sizeof(sample));
+ if (ft5x06_sample(priv, (FAR char *)&sample, sizeof(sample)) > 0)
{
- /* After posting this semaphore, we need to exit because the FT5x06
- * is no longer available.
- */
-
- nxsem_post(&priv->waitsem);
+ touch_event(priv->config.lower.priv, &sample);
}
}
@@ -240,8 +188,8 @@ static void ft5x06_data_worker(FAR void *arg)
/* Get a pointer the callbacks for convenience */
- DEBUGASSERT(priv != NULL && priv->config != NULL);
- config = priv->config;
+ DEBUGASSERT(priv != NULL);
+ config = &priv->config;
/* We need to have exclusive access to the touchbuf so that we do not
* corrupt any read operation that is in place.
@@ -374,7 +322,7 @@ static int ft5x06_data_interrupt(int irq, FAR void *context, FAR void *arg)
* ugly).
*/
- config = priv->config;
+ config = &priv->config;
DEBUGASSERT(config != NULL);
/* Disable further interrupts */
@@ -429,13 +377,8 @@ static ssize_t ft5x06_sample(FAR struct ft5x06_dev_s *priv, FAR char *buffer,
/* Get the reported X and Y positions */
- #ifdef CONFIG_FT5X06_SWAPXY
- y = TOUCH_POINT_GET_X(touch[0]);
- x = TOUCH_POINT_GET_Y(touch[0]);
-#else
x = TOUCH_POINT_GET_X(touch[0]);
y = TOUCH_POINT_GET_Y(touch[0]);
-#endif
/* Get the touch point ID and event */
@@ -582,13 +525,8 @@ static ssize_t ft5x06_sample(FAR struct ft5x06_dev_s *priv, FAR char *buffer,
point[i].id = TOUCH_POINT_GET_ID(touch[i]);
point[i].flags = g_event_map[event];
-#ifdef CONFIG_FT5X06_SWAPXY
- point[i].y = TOUCH_POINT_GET_X(touch[i]);
- point[i].x = TOUCH_POINT_GET_Y(touch[i]);
-#else
point[i].x = TOUCH_POINT_GET_X(touch[i]);
point[i].y = TOUCH_POINT_GET_Y(touch[i]);
-#endif
point[i].h = 0;
point[i].w = 0;
point[i].pressure = 0;
@@ -599,71 +537,13 @@ static ssize_t ft5x06_sample(FAR struct ft5x06_dev_s *priv, FAR char *buffer,
}
#endif /* CONFIG_FT5X06_SINGLEPOINT */
-/****************************************************************************
- * Name: ft5x06_waitsample
- ****************************************************************************/
-
-static ssize_t ft5x06_waitsample(FAR struct ft5x06_dev_s *priv,
- FAR char *buffer, size_t len)
-{
- int ret;
-
- /* Now release the semaphore that manages mutually exclusive access to
- * the device structure. This may cause other tasks to become ready to
- * run, but they cannot run yet because pre-emption is disabled.
- */
-
- nxmutex_unlock(&priv->devlock);
-
- /* Try to get the a sample... if we cannot, then wait on the semaphore
- * that is posted when new sample data is available.
- */
-
- while (!priv->valid)
- {
- /* Increment the count of waiters */
-
- priv->nwaiters++;
-
- /* Wait for a change in the FT5x06 state */
-
- ret = nxsem_wait(&priv->waitsem);
- priv->nwaiters--;
-
- if (ret < 0)
- {
- ierr("ERROR: nxsem_wait failed: %d\n", ret);
- goto errout;
- }
- }
-
- /* Re-acquire the semaphore that manages mutually exclusive access to
- * the device structure. We may have to wait here. But we have our
- * sample. Interrupts and pre-emption will be re-enabled while we wait.
- */
-
- ret = nxmutex_lock(&priv->devlock);
- if (ret >= 0)
- {
- /* Now sample the data.
- *
- * REVISIT: Is it safe to assume that priv->valid will always be
- * true? I think that sched_lock() would protect the setting.
- */
-
- ret = ft5x06_sample(priv, buffer, len);
- }
-
-errout:
- return ret;
-}
-
/****************************************************************************
* Name: ft5x06_bringup
****************************************************************************/
-static int ft5x06_bringup(FAR struct ft5x06_dev_s *priv)
+static int ft5x06_bringup(FAR struct touch_lowerhalf_s *lower)
{
+ FAR struct ft5x06_dev_s *priv = (FAR struct ft5x06_dev_s *)lower;
FAR const struct ft5x06_config_s *config;
struct i2c_msg_s msg;
uint8_t data[2];
@@ -673,7 +553,7 @@ static int ft5x06_bringup(FAR struct ft5x06_dev_s *priv)
* ugly).
*/
- config = priv->config;
+ config = &priv->config;
DEBUGASSERT(config != NULL);
/* Set device mode to normal operation */
@@ -706,215 +586,38 @@ static int ft5x06_bringup(FAR struct ft5x06_dev_s *priv)
* Name: ft5x06_shutdown
****************************************************************************/
-static void ft5x06_shutdown(FAR struct ft5x06_dev_s *priv)
+static int ft5x06_shutdown(FAR struct touch_lowerhalf_s *lower)
{
+ FAR struct ft5x06_dev_s *priv = (FAR struct ft5x06_dev_s *)lower;
+
#ifdef CONFIG_FT5X06_POLLMODE
/* Stop the poll timer */
wd_cancel(&priv->polltimer);
#else
- FAR const struct ft5x06_config_s *config = priv->config;
+ FAR const struct ft5x06_config_s *config = &priv->config;
/* Make sure that the FT5x06 interrupt is disabled */
config->clear(config);
config->enable(config, false);
#endif
-}
-
-/****************************************************************************
- * Name: ft5x06_open
- ****************************************************************************/
-
-static int ft5x06_open(FAR struct file *filep)
-{
- FAR struct inode *inode;
- FAR struct ft5x06_dev_s *priv;
- uint8_t tmp;
- int ret;
-
- inode = filep->f_inode;
-
- DEBUGASSERT(inode->i_private);
- priv = inode->i_private;
-
- /* Get exclusive access to the driver data structure */
-
- ret = nxmutex_lock(&priv->devlock);
- if (ret < 0)
- {
- ierr("ERROR: nxmutex_lock failed: %d\n", ret);
- return ret;
- }
-
- /* Increment the reference count */
-
- tmp = priv->crefs + 1;
- if (tmp == 0)
- {
- /* More than 255 opens; uint8_t overflows to zero */
-
- ret = -EMFILE;
- goto errout_with_lock;
- }
-
- /* When the reference increments to 1, this is the first open event
- * on the driver.. and the time when we must initialize the driver.
- */
-
- if (tmp == 1)
- {
- ret = ft5x06_bringup(priv);
- if (ret < 0)
- {
- ierr("ERROR: ft5x06_bringup failed: %d\n", ret);
- goto errout_with_lock;
- }
- }
-
- /* Save the new open count on success */
-
- priv->crefs = tmp;
-
-errout_with_lock:
- nxmutex_unlock(&priv->devlock);
- return ret;
-}
-
-/****************************************************************************
- * Name: ft5x06_close
- ****************************************************************************/
-
-static int ft5x06_close(FAR struct file *filep)
-{
- FAR struct inode *inode;
- FAR struct ft5x06_dev_s *priv;
- int ret;
-
- inode = filep->f_inode;
-
- DEBUGASSERT(inode->i_private);
- priv = inode->i_private;
-
- /* Get exclusive access to the driver data structure */
-
- ret = nxmutex_lock(&priv->devlock);
- if (ret < 0)
- {
- ierr("ERROR: nxmutex_lock failed: %d\n", ret);
- return ret;
- }
-
- /* Decrement the reference count unless it would decrement a negative
- * value.
- */
- if (priv->crefs >= 1)
- {
- priv->crefs--;
- }
-
- /* When the count decrements to zero, there are no further open references
- * to the driver and it can be uninitialized.
- */
-
- if (priv->crefs == 0)
- {
- ft5x06_shutdown(priv);
- }
-
- nxmutex_unlock(&priv->devlock);
- return OK;
-}
-
-/****************************************************************************
- * Name: ft5x06_read
- ****************************************************************************/
-
-static ssize_t ft5x06_read(FAR struct file *filep, FAR char *buffer,
- size_t len)
-{
- FAR struct inode *inode;
- FAR struct ft5x06_dev_s *priv;
- int ret;
-
- inode = filep->f_inode;
-
- DEBUGASSERT(inode->i_private);
- priv = inode->i_private;
-
- /* Verify that the caller has provided a buffer large enough to receive
- * the touch data.
- */
-
- if (len < SIZEOF_TOUCH_SAMPLE_S(1))
- {
- /* We could provide logic to break up a touch report into segments and
- * handle smaller reads... but why?
- */
-
- return -ENOSYS;
- }
-
- /* Get exclusive access to the driver data structure */
-
- ret = nxmutex_lock(&priv->devlock);
- if (ret < 0)
- {
- ierr("ERROR: nxmutex_lock failed: %d\n", ret);
- return ret;
- }
-
- /* Try to read sample data. */
-
- ret = ft5x06_sample(priv, buffer, len);
- while (ret == 0)
- {
- /* Sample data is not available now. We would have to wait to receive
- * sample data. If the user has specified the O_NONBLOCK option, then
- * just return an error.
- */
-
- if (filep->f_oflags & O_NONBLOCK)
- {
- ret = -EAGAIN;
- goto errout;
- }
-
- /* Wait for sample data */
-
- ret = ft5x06_waitsample(priv, buffer, len);
- if (ret < 0)
- {
- /* We might have been awakened by a signal */
-
- goto errout;
- }
- }
-
- ret = SIZEOF_TOUCH_SAMPLE_S(1);
-
-errout:
- nxmutex_unlock(&priv->devlock);
- return ret;
+ return 0;
}
/****************************************************************************
* Name: ft5x06_ioctl
****************************************************************************/
-static int ft5x06_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
+static int ft5x06_ioctl(FAR struct touch_lowerhalf_s *lower, int cmd,
+ unsigned long arg)
{
- FAR struct inode *inode;
- FAR struct ft5x06_dev_s *priv;
+ FAR struct ft5x06_dev_s *priv = (FAR struct ft5x06_dev_s *)lower;
int ret;
iinfo("cmd: %d arg: %ld\n", cmd, arg);
- inode = filep->f_inode;
-
- DEBUGASSERT(inode->i_private);
- priv = inode->i_private;
/* Get exclusive access to the driver data structure */
@@ -932,7 +635,7 @@ static int ft5x06_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case TSIOC_SETFREQUENCY: /* arg: Pointer to uint32_t frequency value */
{
FAR uint32_t *ptr = (FAR uint32_t *)((uintptr_t)arg);
- DEBUGASSERT(priv->config != NULL && ptr != NULL);
+ DEBUGASSERT(ptr != NULL);
priv->frequency = *ptr;
}
break;
@@ -940,7 +643,7 @@ static int ft5x06_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case TSIOC_GETFREQUENCY: /* arg: Pointer to uint32_t frequency value */
{
FAR uint32_t *ptr = (FAR uint32_t *)((uintptr_t)arg);
- DEBUGASSERT(priv->config != NULL && ptr != NULL);
+ DEBUGASSERT(ptr != NULL);
*ptr = priv->frequency;
}
break;
@@ -954,101 +657,6 @@ static int ft5x06_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
return ret;
}
-/****************************************************************************
- * Name: ft5x06_poll
- ****************************************************************************/
-
-static int ft5x06_poll(FAR struct file *filep, FAR struct pollfd *fds,
- bool setup)
-{
- FAR struct inode *inode;
- FAR struct ft5x06_dev_s *priv;
- int ret;
- int i;
-
- iinfo("setup: %d\n", (int)setup);
- DEBUGASSERT(fds);
- inode = filep->f_inode;
-
- DEBUGASSERT(inode->i_private);
- priv = inode->i_private;
-
- /* Are we setting up the poll? Or tearing it down? */
-
- ret = nxmutex_lock(&priv->devlock);
- if (ret < 0)
- {
- ierr("ERROR: nxmutex_lock failed: %d\n", ret);
- return ret;
- }
-
- if (setup)
- {
- /* Ignore waits that do not include POLLIN */
-
- if ((fds->events & POLLIN) == 0)
- {
- ierr("ERROR: Missing POLLIN: revents: %08" PRIx32 "\n",
- fds->revents);
- ret = -EDEADLK;
- goto errout;
- }
-
- /* This is a request to set up the poll. Find an available
- * slot for the poll structure reference
- */
-
- for (i = 0; i < CONFIG_FT5X06_NPOLLWAITERS; i++)
- {
- /* Find an available slot */
-
- if (!priv->fds[i])
- {
- /* Bind the poll structure and this slot */
-
- priv->fds[i] = fds;
- fds->priv = &priv->fds[i];
- break;
- }
- }
-
- if (i >= CONFIG_FT5X06_NPOLLWAITERS)
- {
- ierr("ERROR: No available slot found: %d\n", i);
- fds->priv = NULL;
- ret = -EBUSY;
- goto errout;
- }
-
- /* Should we immediately notify on any of the requested events? */
-
- if (priv->valid)
- {
- poll_notify(&fds, 1, POLLIN);
- }
- }
- else if (fds->priv)
- {
- /* This is a request to tear down the poll. */
-
- FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv;
- DEBUGASSERT(slot != NULL);
-
- /* Remove all memory of the poll setup */
-
- *slot = NULL;
- fds->priv = NULL;
- }
-
-errout:
- nxmutex_unlock(&priv->devlock);
- return ret;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -1101,11 +709,13 @@ int ft5x06_register(FAR struct i2c_master_s *i2c,
/* Initialize the FT5x06 device driver instance */
priv->i2c = i2c; /* Save the I2C device handle */
- priv->config = config; /* Save the board configuration */
priv->frequency = config->frequency; /* Set the current I2C frequency */
+ /* Save the board configuration */
+
+ memcpy(&priv->config, config, sizeof(priv->config));
+
nxmutex_init(&priv->devlock); /* Initialize device structure mutex */
- nxsem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */
#ifdef CONFIG_FT5X06_POLLMODE
/* Allocate a timer for polling the FT5x06 */
@@ -1130,10 +740,14 @@ int ft5x06_register(FAR struct i2c_master_s *i2c,
/* Register the device as an input device */
+ priv->config.lower.open = ft5x06_bringup;
+ priv->config.lower.close = ft5x06_shutdown;
+ priv->config.lower.control = ft5x06_ioctl;
snprintf(devname, sizeof(devname), DEV_FORMAT, minor);
iinfo("Registering %s\n", devname);
- ret = register_driver(devname, &g_ft5x06_fops, 0666, priv);
+ ret = touch_register(&priv->config.lower, devname,
+ CONFIG_FT5X06_SAMPLE_NBUFFER);
if (ret < 0)
{
ierr("ERROR: register_driver() failed: %d\n", ret);
@@ -1157,7 +771,6 @@ int ft5x06_register(FAR struct i2c_master_s *i2c,
errout_with_priv:
nxmutex_destroy(&priv->devlock);
- nxsem_destroy(&priv->waitsem);
kmm_free(priv);
return ret;
}
diff --git a/include/nuttx/input/ft5x06.h b/include/nuttx/input/ft5x06.h
index ef81fa0cf4..72e74d6a6f 100644
--- a/include/nuttx/input/ft5x06.h
+++ b/include/nuttx/input/ft5x06.h
@@ -40,6 +40,7 @@
#include <nuttx/irq.h>
#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/input/touchscreen.h>
#ifdef CONFIG_INPUT_FT5X06
@@ -81,6 +82,7 @@ struct ft5x06_config_s
{
/* Device characterization */
+ struct touch_lowerhalf_s lower;
uint8_t address; /* 7-bit I2C address (only bits 0-6 used) */
uint32_t frequency; /* Default I2C frequency */
(nuttx) 06/06: boards/szpi-esp32s3: Enable touchscreen for LVGL
Posted by ac...@apache.org.
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
commit e5b138dee0d1ed607ec92a02ce98ff1cb0840e9c
Author: wangjianyu3 <wa...@xiaomi.com>
AuthorDate: Sat Jul 5 02:55:18 2025 +0800
boards/szpi-esp32s3: Enable touchscreen for LVGL
1. Rotate the video screen 90 degrees right.
2. Enable touchscreen for the LVGL configuration "lckfb-szpi-esp32s3:lvgl" and add lvgldemo autostart.
Signed-off-by: wangjianyu3 <wa...@xiaomi.com>
---
boards/xtensa/esp32s3/lckfb-szpi-esp32s3/Kconfig | 18 ++++++++++++++++++
.../esp32s3/lckfb-szpi-esp32s3/configs/lvgl/defconfig | 15 +++++++++++++++
.../esp32s3/lckfb-szpi-esp32s3/src/esp32s3_ft5x06.c | 14 ++++++++++++++
.../esp32s3/lckfb-szpi-esp32s3/src/etc/init.d/rcS | 4 ++++
4 files changed, 51 insertions(+)
diff --git a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/Kconfig b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/Kconfig
index 8d353159eb..10a43241da 100644
--- a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/Kconfig
+++ b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/Kconfig
@@ -5,4 +5,22 @@
if ARCH_BOARD_ESP32S3_LCKFB_SZPI
+config ARCH_BOARD_ESP32S3_LCKFB_SZPI_DISPLAY_XRES
+ int
+ default LCD_ST7789_XRES
+ depends on LCD_ST7789
+
+config ARCH_BOARD_ESP32S3_LCKFB_SZPI_DISPLAY_YRES
+ int
+ default LCD_ST7789_YRES
+ depends on LCD_ST7789
+
+config ARCH_BOARD_ESP32S3_LCKFB_SZPI_TOUCHSCREEN_MIRRORY
+ bool "SZPI-ESP32-S3 Touchscreen mirror Y"
+ depends on INPUT_TOUCHSCREEN
+
+config ARCH_BOARD_ESP32S3_LCKFB_SZPI_TOUCHSCREEN_SWAPXY
+ bool "SZPI-ESP32-S3 Touchscreen sway X/Y"
+ depends on INPUT_TOUCHSCREEN
+
endif # ARCH_BOARD_ESP32S3_LCKFB_SZPI
diff --git a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/lvgl/defconfig b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/lvgl/defconfig
index 277806a3b6..8119354fa5 100644
--- a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/lvgl/defconfig
+++ b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/configs/lvgl/defconfig
@@ -13,6 +13,8 @@ CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="lckfb-szpi-esp32s3"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_LCKFB_SZPI=y
+CONFIG_ARCH_BOARD_ESP32S3_LCKFB_SZPI_TOUCHSCREEN_MIRRORY=y
+CONFIG_ARCH_BOARD_ESP32S3_LCKFB_SZPI_TOUCHSCREEN_SWAPXY=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y
@@ -49,10 +51,15 @@ CONFIG_ESP32S3_UART0=y
CONFIG_ESPRESSIF_LEDC=y
CONFIG_ESPRESSIF_LEDC_CHANNEL0_PIN=42
CONFIG_ESPRESSIF_LEDC_TIMER0=y
+CONFIG_ETC_ROMFS=y
CONFIG_EXAMPLES_FB=y
CONFIG_EXAMPLES_LVGLDEMO=y
CONFIG_EXAMPLES_PWM=y
+CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_FS_PROCFS=y
+CONFIG_FS_ROMFS=y
+CONFIG_FT5X06_POLLMODE=y
+CONFIG_FT5X06_SINGLEPOINT=y
CONFIG_GPIO_LOWER_HALF=y
CONFIG_GRAPHICS_LVGL=y
CONFIG_HAVE_CXX=y
@@ -60,6 +67,8 @@ CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
+CONFIG_INPUT=y
+CONFIG_INPUT_FT5X06=y
CONFIG_INTELHEX_BINARY=y
CONFIG_IOEXPANDER=y
CONFIG_IOEXPANDER_NPINS=8
@@ -71,6 +80,10 @@ CONFIG_LCD_PORTRAIT=y
CONFIG_LCD_ST7789=y
CONFIG_LCD_ST7789_DATA_ENDIAN_LITTLE=y
CONFIG_LCD_ST7789_FREQUENCY=40000000
+CONFIG_LCD_ST7789_MIRRORV=y
+CONFIG_LCD_ST7789_MIRRORX=y
+CONFIG_LCD_ST7789_XRES=320
+CONFIG_LCD_ST7789_YRES=240
CONFIG_LINE_MAX=64
CONFIG_LV_USE_CLIB_MALLOC=y
CONFIG_LV_USE_CLIB_SPRINTF=y
@@ -79,6 +92,7 @@ CONFIG_LV_USE_DEMO_WIDGETS=y
CONFIG_LV_USE_LOG=y
CONFIG_LV_USE_NUTTX=y
CONFIG_LV_USE_NUTTX_LCD=y
+CONFIG_LV_USE_NUTTX_TOUCHSCREEN=y
CONFIG_LV_USE_ST7789=y
CONFIG_MM_REGIONS=2
CONFIG_NSH_ARCHINIT=y
@@ -89,6 +103,7 @@ CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SPI_CMDDATA=y
CONFIG_START_DAY=6
diff --git a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/esp32s3_ft5x06.c b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/esp32s3_ft5x06.c
index d680240eed..917f984c12 100644
--- a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/esp32s3_ft5x06.c
+++ b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/esp32s3_ft5x06.c
@@ -33,6 +33,7 @@
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/input/ft5x06.h>
+#include <nuttx/input/touchscreen.h>
#include "esp32s3_i2c.h"
#include "esp32s3-szpi.h"
@@ -55,6 +56,19 @@ static const struct ft5x06_config_s g_ft5x06_config =
{
.address = FT5X06_I2C_ADDRESS,
.frequency = FT5X06_FREQUENCY,
+ .lower =
+ {
+ .xres = CONFIG_ARCH_BOARD_ESP32S3_LCKFB_SZPI_DISPLAY_XRES,
+ .yres = CONFIG_ARCH_BOARD_ESP32S3_LCKFB_SZPI_DISPLAY_YRES,
+ .flags = 0
+#ifdef CONFIG_ARCH_BOARD_ESP32S3_LCKFB_SZPI_TOUCHSCREEN_SWAPXY
+ | TOUCH_FLAG_SWAPXY
+#endif
+#ifdef CONFIG_ARCH_BOARD_ESP32S3_LCKFB_SZPI_TOUCHSCREEN_MIRRORY
+ | TOUCH_FLAG_MIRRORY
+#endif
+ ,
+ },
};
/****************************************************************************
diff --git a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/etc/init.d/rcS b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/etc/init.d/rcS
index 1e043aa976..c0d9a0faaa 100644
--- a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/etc/init.d/rcS
+++ b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/etc/init.d/rcS
@@ -29,3 +29,7 @@ adbd &
#ifdef CONFIG_SYSTEM_FASTBOOTD
fastbootd &
#endif
+
+#ifdef CONFIG_EXAMPLES_LVGLDEMO
+lvgldemo widgets &
+#endif
(nuttx) 01/06: driver/touchscreen: add custom open/close
Posted by ac...@apache.org.
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
commit 9f6666b75bb59ff7b1ca29585265860d8db0f065
Author: wangjianyu3 <wa...@xiaomi.com>
AuthorDate: Sun Jul 6 00:29:25 2025 +0800
driver/touchscreen: add custom open/close
Add custom open/close for lower to init/deinit device.
Signed-off-by: wangjianyu3 <wa...@xiaomi.com>
---
drivers/input/touchscreen_upper.c | 11 +++++++++++
include/nuttx/input/touchscreen.h | 30 ++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/drivers/input/touchscreen_upper.c b/drivers/input/touchscreen_upper.c
index 12f7d1f5ff..9afcfcc82f 100644
--- a/drivers/input/touchscreen_upper.c
+++ b/drivers/input/touchscreen_upper.c
@@ -149,6 +149,11 @@ static int touch_open(FAR struct file *filep)
filep->f_priv = openpriv;
nxmutex_unlock(&upper->lock);
+ if (lower->open)
+ {
+ return lower->open(lower);
+ }
+
return ret;
}
@@ -161,6 +166,7 @@ static int touch_close(FAR struct file *filep)
FAR struct touch_openpriv_s *openpriv = filep->f_priv;
FAR struct inode *inode = filep->f_inode;
FAR struct touch_upperhalf_s *upper = inode->i_private;
+ FAR struct touch_lowerhalf_s *lower = upper->lower;
int ret;
ret = nxmutex_lock(&upper->lock);
@@ -181,6 +187,11 @@ static int touch_close(FAR struct file *filep)
kmm_free(openpriv);
nxmutex_unlock(&upper->lock);
+ if (lower->close)
+ {
+ return lower->close(lower);
+ }
+
return ret;
}
diff --git a/include/nuttx/input/touchscreen.h b/include/nuttx/input/touchscreen.h
index 26a39d68db..0f4190e323 100644
--- a/include/nuttx/input/touchscreen.h
+++ b/include/nuttx/input/touchscreen.h
@@ -273,6 +273,36 @@ struct touch_lowerhalf_s
CODE ssize_t (*write)(FAR struct touch_lowerhalf_s *lower,
FAR const char *buffer, size_t buflen);
+
+ /**************************************************************************
+ * Name: open
+ *
+ * Description:
+ * Users can use this interface to implement custom open().
+ *
+ * Arguments:
+ * lower - The instance of lower half of touchscreen device.
+ *
+ * Return Value:
+ * Zero(OK) on success; a negated errno value on failure.
+ **************************************************************************/
+
+ CODE int (*open)(FAR struct touch_lowerhalf_s *lower);
+
+ /**************************************************************************
+ * Name: close
+ *
+ * Description:
+ * Users can use this interface to implement custom close().
+ *
+ * Arguments:
+ * lower - The instance of lower half of touchscreen device.
+ *
+ * Return Value:
+ * Zero(OK) on success; a negated errno value on failure.
+ **************************************************************************/
+
+ CODE int (*close)(FAR struct touch_lowerhalf_s *lower);
};
/****************************************************************************
(nuttx) 02/06: include: fix typo of touch lowerhalf comment
Posted by ac...@apache.org.
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
commit 7cd5d3db72594fc703aa824dc41e7e45477f427a
Author: wangjianyu3 <wa...@xiaomi.com>
AuthorDate: Sun Jul 6 00:33:50 2025 +0800
include: fix typo of touch lowerhalf comment
Signed-off-by: wangjianyu3 <wa...@xiaomi.com>
---
include/nuttx/input/touchscreen.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/nuttx/input/touchscreen.h b/include/nuttx/input/touchscreen.h
index 0f4190e323..f93a4eb300 100644
--- a/include/nuttx/input/touchscreen.h
+++ b/include/nuttx/input/touchscreen.h
@@ -267,7 +267,7 @@ struct touch_lowerhalf_s
* buflen - User defined specific buffer size.
*
* Return Value:
- * Number of bytes written;a negated errno value on failure.
+ * Number of bytes written; a negated errno value on failure.
*
**************************************************************************/