examples/lvgldemo: Make touch calibration optional
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
2c924f657f
commit
afaf013832
@ -11,6 +11,13 @@ menuconfig EXAMPLES_LVGLDEMO
|
|||||||
|
|
||||||
if 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
|
choice
|
||||||
prompt "Select a demo application"
|
prompt "Select a demo application"
|
||||||
default EXAMPLES_LVGLDEMO_SIMPLE
|
default EXAMPLES_LVGLDEMO_SIMPLE
|
||||||
|
@ -153,6 +153,30 @@ int main(int argc, FAR char *argv[])
|
|||||||
lv_disp_buf_t disp_buf;
|
lv_disp_buf_t disp_buf;
|
||||||
static lv_color_t buf[CONFIG_LV_VDB_SIZE];
|
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
|
#ifdef NEED_BOARDINIT
|
||||||
/* Perform board-specific driver initialization */
|
/* Perform board-specific driver initialization */
|
||||||
|
|
||||||
@ -237,8 +261,11 @@ int main(int argc, FAR char *argv[])
|
|||||||
|
|
||||||
/* Start TP calibration */
|
/* Start TP calibration */
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLES_LVGLDEMO_CALIBRATE
|
||||||
tp_cal_create();
|
tp_cal_create();
|
||||||
|
#else
|
||||||
|
tp_set_cal_values(p, p + 1, p + 2, p + 3);
|
||||||
|
#endif
|
||||||
/* Handle LittlevGL tasks */
|
/* Handle LittlevGL tasks */
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user