samples: display: Enhance lvgl sample to support touch input

Enhances the lvgl sample to support an optional touch panel input on
mimxrt10{50,60,64}_evk boards.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
This commit is contained in:
Maureen Helm 2020-01-20 15:49:02 -06:00 committed by Anas Nashif
parent cad729dcfb
commit 06d17aa68d
3 changed files with 17 additions and 2 deletions

View file

@ -7,7 +7,10 @@ Overview
********
This sample application displays "Hello World" in the center of the screen
and a counter at the bottom which increments every second.
and a counter at the bottom which increments every second. If an input driver
is supported, such as the touch panel controller on mimxrt10{50,60,64}_evk
boards, "Hello World" is enclosed in a button that changes to the toggled state
when touched.
Requirements
************

View file

@ -7,3 +7,5 @@ CONFIG_LOG=y
CONFIG_LVGL=y
CONFIG_LVGL_OBJ_LABEL=y
CONFIG_LVGL_OBJ_CONTAINER=y
CONFIG_LVGL_OBJ_BUTTON=y

View file

@ -30,7 +30,17 @@ void main(void)
return;
}
hello_world_label = lv_label_create(lv_scr_act(), NULL);
if (IS_ENABLED(CONFIG_LVGL_POINTER_KSCAN)) {
lv_obj_t *hello_world_button;
hello_world_button = lv_btn_create(lv_scr_act(), NULL);
lv_obj_align(hello_world_button, NULL, LV_ALIGN_CENTER, 0, 0);
lv_btn_set_fit(hello_world_button, LV_FIT_TIGHT);
hello_world_label = lv_label_create(hello_world_button, NULL);
} else {
hello_world_label = lv_label_create(lv_scr_act(), NULL);
}
lv_label_set_text(hello_world_label, "Hello world!");
lv_obj_align(hello_world_label, NULL, LV_ALIGN_CENTER, 0, 0);