Skip to content

Commit

Permalink
Update touch driver, update test examples #34
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Apr 29, 2024
1 parent 5c668c2 commit 30f708d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions examples/LVGL_Rotation/LVGL_Rotation.ino
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ void setup(void)
lv_obj_t *btn = lv_btn_create(lv_scr_act());
lv_obj_t *label = lv_label_create(btn);
lv_label_set_text_fmt(label, "%d", i);
lv_obj_add_flag(btn, LV_OBJ_FLAG_CHECKABLE);
lv_obj_center(btn);
lv_obj_align(btn, align[i], 0, 0);
}
Expand Down Expand Up @@ -140,11 +141,11 @@ void setup(void)

void loop()
{
static int16_t x, y;
uint8_t rotation = amoled.getRotation();
bool touched = amoled.getPoint(&x, &y);
if ( touched ) {
lv_label_set_text_fmt(label1, format_string, x, y, amoled.getRotation(), amoled.getName());
lv_indev_t *indev = lv_indev_get_next(NULL);
lv_point_t point;
if ( indev->proc.state == LV_INDEV_STATE_PRESSED ) {
lv_indev_get_point(indev, &point);
lv_label_set_text_fmt(label1, format_string, point.x, point.y, amoled.getRotation(), amoled.getName());
}
lv_task_handler();
button.check();
Expand Down
4 changes: 2 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ lib_deps =
bxparks/AceButton @ 1.10.1
lvgl/lvgl @ ~8.3.11
lewisxhe/XPowersLib @ 0.2.1
lewisxhe/SensorLib @ 0.1.6
lewisxhe/SensorLib @ 0.2.0
bodmer/TFT_eSPI @ 2.5.31
FS
SPIFFS
Expand All @@ -167,5 +167,5 @@ build_flags =
${env.build_flags}
lib_deps =
moononournation/GFX Library for Arduino @ ^1.3.7
lewisxhe/SensorLib @ 0.1.6
lewisxhe/SensorLib @ 0.2.0

0 comments on commit 30f708d

Please sign in to comment.