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 2020/06/10 11:44:44 UTC

[incubator-nuttx-apps] branch master updated: examples/lvgldemo: Make touch calibration optional

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/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new afaf013  examples/lvgldemo: Make touch calibration optional
afaf013 is described below

commit afaf01383252276f339a9577c66dc5a27749dc8d
Author: Huang Qi <hu...@xiaomi.com>
AuthorDate: Wed Jun 10 11:12:59 2020 +0800

    examples/lvgldemo: Make touch calibration optional
    
    Signed-off-by: Huang Qi <hu...@xiaomi.com>
---
 examples/lvgldemo/Kconfig    |  7 +++++++
 examples/lvgldemo/lvgldemo.c | 29 ++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/examples/lvgldemo/Kconfig b/examples/lvgldemo/Kconfig
index b7f1778..0ac756d 100644
--- a/examples/lvgldemo/Kconfig
+++ b/examples/lvgldemo/Kconfig
@@ -11,6 +11,13 @@ menuconfig EXAMPLES_LVGLDEMO
 
 if EXAMPLES_LVGLDEMO
 
+config EXAMPLES_LVGLDEMO_CALIBRATE
+	bool "Calibrate touchscreen"
+	default y
+	---help---
+		Calibrate touchscreen before demo start, but some touchscreen
+		don't need it, like capacitive touchscreen.
+
 choice
 	prompt "Select a demo application"
 	default EXAMPLES_LVGLDEMO_SIMPLE
diff --git a/examples/lvgldemo/lvgldemo.c b/examples/lvgldemo/lvgldemo.c
index e83adb6..e4893d4 100644
--- a/examples/lvgldemo/lvgldemo.c
+++ b/examples/lvgldemo/lvgldemo.c
@@ -153,6 +153,30 @@ int main(int argc, FAR char *argv[])
   lv_disp_buf_t disp_buf;
   static lv_color_t buf[CONFIG_LV_VDB_SIZE];
 
+#ifndef CONFIG_EXAMPLES_LVGLDEMO_CALIBRATE
+  lv_point_t p[4];
+
+  /* top left */
+
+  p[0].x = 0;
+  p[0].y = 0;
+
+  /* top right */
+
+  p[1].x = LV_HOR_RES;
+  p[1].y = 0;
+
+  /* bottom left */
+
+  p[2].x = 0;
+  p[2].y = LV_VER_RES;
+
+  /* bottom right */
+
+  p[3].x = LV_HOR_RES;
+  p[3].y = LV_VER_RES;
+#endif
+
 #ifdef NEED_BOARDINIT
   /* Perform board-specific driver initialization */
 
@@ -237,8 +261,11 @@ int main(int argc, FAR char *argv[])
 
   /* Start TP calibration */
 
+#ifdef CONFIG_EXAMPLES_LVGLDEMO_CALIBRATE
   tp_cal_create();
-
+#else
+  tp_set_cal_values(p, p + 1, p + 2, p + 3);
+#endif
   /* Handle LittlevGL tasks */
 
   while (1)