feat(example): make "LVGL_Arduino.ino" easier to use (#6001)

This commit is contained in:
Klaus Musch
2024-04-06 12:10:32 +02:00
committed by GitHub
parent 3e21769fa6
commit b74d34407f
2 changed files with 33 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*Using LVGL with Arduino requires some extra steps:
*Be sure to read the docs here: https://docs.lvgl.io/master/get-started/platforms/arduino.html */
*Be sure to read the docs here: https://docs.lvgl.io/master/integration/framework/arduino.html */
#include <lvgl.h>
@@ -15,9 +15,10 @@
//#include <examples/lv_examples.h>
//#include <demos/lv_demos.h>
/*Set to your screen resolution*/
/*Set to your screen resolution and rotation*/
#define TFT_HOR_RES 320
#define TFT_VER_RES 240
#define TFT_ROTATION LV_DISPLAY_ROTATION_0
/*LVGL draw into this buffer, 1/10 screen size usually works well. The size is in bytes*/
#define DRAW_BUF_SIZE (TFT_HOR_RES * TFT_VER_RES / 10 * (LV_COLOR_DEPTH / 8))
@@ -95,6 +96,8 @@ void setup()
#if LV_USE_TFT_ESPI
/*TFT_eSPI can be enabled lv_conf.h to initialize the display in a simple way*/
disp = lv_tft_espi_create(TFT_HOR_RES, TFT_VER_RES, draw_buf, sizeof(draw_buf));
lv_display_set_rotation(disp, TFT_ROTATION);
#else
/*Else create a display yourself*/
disp = lv_display_create(TFT_HOR_RES, TFT_VER_RES);