Skip to content

Commit

Permalink
samples: display: Enhance lvgl sample to support touch input
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
MaureenHelm committed Jan 28, 2020
1 parent 7ccea08 commit 1f2935f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
5 changes: 4 additions & 1 deletion samples/display/lvgl/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
************
Expand Down
2 changes: 2 additions & 0 deletions samples/display/lvgl/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 11 additions & 1 deletion samples/display/lvgl/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 1f2935f

Please sign in to comment.