lvgl: lv_disp_draw_buf_t' does not name a type

Hi everybody This error is reported many times since 2021 over the net and seems to be related to the LVGL versions over 8.0, but i didn’t find a clear solution. i’ve tried with 7.8.1 but have the same error. I’m new to LVGL and simply want to try the lvgl widgets arduino demo . the setup uses thoses snippets:

/* Change to your screen resolution */
static uint32_t screenWidth;
static uint32_t screenHeight;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t *disp_draw_buf;
static lv_disp_drv_t disp_drv;

/* Initialize the display */
    lv_disp_drv_init(&disp_drv);
    /* Change the following line to your display resolution */
    disp_drv.hor_res = screenWidth;
    disp_drv.ver_res = screenHeight;
    disp_drv.flush_cb = my_disp_flush;
    disp_drv.draw_buf = &draw_buf;
    lv_disp_drv_register(&disp_drv);

/* Initialize the (dummy) input device driver */
    static lv_indev_drv_t indev_drv;
    lv_indev_drv_init(&indev_drv);
    indev_drv.type = LV_INDEV_TYPE_POINTER;
    indev_drv.read_cb = my_touchpad_read;
    lv_indev_drv_register(&indev_drv);

Where can i find a LVGL version that fit with those snippets?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 22 (11 by maintainers)

Most upvoted comments

Thank you for sharing it! I think most of these points are also mentioned here. Or is there something missing?

Have you tried with LVGL v9 as well?

Hi everyone, after a long time of reading I was able to solve all the I was able to fix all the bugs and run an example. Here are the problems I had.

Microcontroller: Esp32 c3 super mini screen: GC9A01A

Error #1: Verify that the project is in the correct path, I don’t know if this has to do with any error but better to avoid: C:\Users\you\Documents\Arduino\My_Project.

Error #2: File “lv_conf.h” not created: solution: copy, paste and rename the file:

C:\Users\you\Documents\Arduino\libraries\lvgl\lv_conf_template.

In the path: C:\Users\you\Documents\Arduino\libraries\lv_conf.h.

Modify some lines of code:

/* clang-format off */ #if 1 /*Set it to “1” to enable content */

/Color depth: 8 (A8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888)/ #define LV_COLOR_DEPTH 16 //My display is 16 bit

Error #3: lv_disp_draw_buf_t. solution: change LVGL version to v8.3.

Error #4: …/…/lv_conf.h: No such file or directory. solution: Read well the error path, locate the file and modify:

Example error in path:

  1. c:\users\you\documents\arduino\libraries\lvgl\src\lv_conf_internal.h.

  2. Invoke the file “lv_conf.h” from the current file, keeping in mind how many folders upwards are found in each case:

Example: #include “…/…/lv_conf.h”.

It will not only be in a single file, do it the necessary times until the error stops that are necessary until the error stops coming out.

I use the Arduino_GFX_Library and the lvgl example called hello world.

Well, the built-in examples are compatible with LVGL itself. That’s why they are built in.

However if you are using Arduino be sure to:

Several people already confirmed that it works so I think it’s really working. If you still have some fortitude, please give it an other try. 🤞

Furthermore, the planned end of the cooperation with SquareLine seems to me to be one more argument for going elsewhere.

I understand that it’ raises some questions so let me summarize the implications briefly. Only 2 things will change:

  1. LVGL doesn’t advertise SquareLine in the future
  2. I personally don’t give advice to the SquareLine team.

So if you are happy with SquareLine, you have no reason to stop using it.

Pay attention to lv_indev_drv_t.

Was:

108  /*Initialize the (dummy) input device driver*/
109  static lv_indev_t indev_drv;
110  lv_indev_drv_init( &indev_drv );
111  indev_drv.type = LV_INDEV_TYPE_POINTER;
112  indev_drv.read_cb = my_touchpad_read;
113  lv_indev_drv_register( &indev_drv );

Became:

108  /*Initialize the (dummy) input device driver*/
109  static lv_indev_drv_t indev_drv;
110  lv_indev_drv_init( &indev_drv );
111  indev_drv.type = LV_INDEV_TYPE_POINTER;
112  indev_drv.read_cb = my_touchpad_read;
113  lv_indev_drv_register( &indev_drv );

Version 8

/***************************
 * CURRENT VERSION OF LVGL
 ***************************/
#define LVGL_VERSION_MAJOR 8
#define LVGL_VERSION_MINOR 3
#define LVGL_VERSION_PATCH 7
#define LVGL_VERSION_INFO ""

Error:

C:\Users\Admin\AppData\Local\Temp\arduino_modified_sketch_487082\LVGL_Arduino.ino: In function 'void my_disp_flush(lv_disp_t*, const lv_area_t*, lv_color_t*)':
LVGL_Arduino:41:26: error: cannot convert 'lv_disp_t*' {aka '_lv_disp_t*'} to 'lv_disp_drv_t*' {aka '_lv_disp_drv_t*'}
   41 |     lv_disp_flush_ready( disp );
      |                          ^~~~
      |                          |
      |                          lv_disp_t* {aka _lv_disp_t*}
In file included from c:\users\admin\documents\arduino\libraries\lvgl\src/hal/lv_hal.h:16,
                 from c:\users\admin\documents\arduino\libraries\lvgl\lvgl.h:33,
                 from C:\Users\Admin\Documents\Arduino\libraries\lvgl\src/lvgl.h:17,
                 from C:\Users\Admin\AppData\Local\Temp\arduino_modified_sketch_487082\LVGL_Arduino.ino:4:
c:\users\admin\documents\arduino\libraries\lvgl\src/hal/lv_hal_disp.h:335:67: note:   initializing argument 1 of 'void lv_disp_flush_ready(lv_disp_drv_t*)'
  335 | LV_ATTRIBUTE_FLUSH_READY void lv_disp_flush_ready(lv_disp_drv_t * disp_drv);
      |                                                   ~~~~~~~~~~~~~~~~^~~~~~~~
C:\Users\Admin\AppData\Local\Temp\arduino_modified_sketch_487082\LVGL_Arduino.ino: In function 'void my_touchpad_read(lv_indev_t*, lv_indev_data_t*)':
LVGL_Arduino:49:24: error: 'class TFT_eSPI' has no member named 'getTouch'
   49 |     bool touched = tft.getTouch( &touchX, &touchY, 600 );
      |                        ^~~~~~~~
C:\Users\Admin\AppData\Local\Temp\arduino_modified_sketch_487082\LVGL_Arduino.ino: In function 'void setup()':
LVGL_Arduino:94:9: error: 'class TFT_eSPI' has no member named 'setTouch'
   94 |     tft.setTouch( calData );
      |         ^~~~~~~~
LVGL_Arduino:100:23: error: cannot convert 'lv_disp_t*' {aka '_lv_disp_t*'} to 'lv_disp_drv_t*' {aka '_lv_disp_drv_t*'}
  100 |     lv_disp_drv_init( &disp_drv );
      |                       ^~~~~~~~~
      |                       |
      |                       lv_disp_t* {aka _lv_disp_t*}
c:\users\admin\documents\arduino\libraries\lvgl\src/hal/lv_hal_disp.h:206:39: note:   initializing argument 1 of 'void lv_disp_drv_init(lv_disp_drv_t*)'
  206 | void lv_disp_drv_init(lv_disp_drv_t * driver);
      |                       ~~~~~~~~~~~~~~~~^~~~~~
LVGL_Arduino:102:14: error: 'lv_disp_t' {aka 'struct _lv_disp_t'} has no member named 'hor_res'
  102 |     disp_drv.hor_res = screenWidth;
      |              ^~~~~~~
LVGL_Arduino:103:14: error: 'lv_disp_t' {aka 'struct _lv_disp_t'} has no member named 'ver_res'
  103 |     disp_drv.ver_res = screenHeight;
      |              ^~~~~~~
LVGL_Arduino:104:14: error: 'lv_disp_t' {aka 'struct _lv_disp_t'} has no member named 'flush_cb'
  104 |     disp_drv.flush_cb = my_disp_flush;
      |              ^~~~~~~~
LVGL_Arduino:105:14: error: 'lv_disp_t' {aka 'struct _lv_disp_t'} has no member named 'draw_buf'
  105 |     disp_drv.draw_buf = &draw_buf;
      |              ^~~~~~~~
LVGL_Arduino:106:27: error: cannot convert 'lv_disp_t*' {aka '_lv_disp_t*'} to 'lv_disp_drv_t*' {aka '_lv_disp_drv_t*'}
  106 |     lv_disp_drv_register( &disp_drv );
      |                           ^~~~~~~~~
      |                           |
      |                           lv_disp_t* {aka _lv_disp_t*}
c:\users\admin\documents\arduino\libraries\lvgl\src/hal/lv_hal_disp.h:231:50: note:   initializing argument 1 of 'lv_disp_t* lv_disp_drv_register(lv_disp_drv_t*)'
  231 | lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver);
      |                                  ~~~~~~~~~~~~~~~~^~~~~~
LVGL_Arduino:112:25: error: invalid conversion from 'void (*)(lv_indev_t*, lv_indev_data_t*)' {aka 'void (*)(_lv_indev_t*, lv_indev_data_t*)'} to 'void (*)(_lv_indev_drv_t*, lv_indev_data_t*)' [-fpermissive]
  112 |     indev_drv.read_cb = my_touchpad_read;
      |                         ^~~~~~~~~~~~~~~~
      |                         |
      |                         void (*)(lv_indev_t*, lv_indev_data_t*) {aka void (*)(_lv_indev_t*, lv_indev_data_t*)}
LVGL_Arduino:127:5: error: 'lv_demo_widgets' was not declared in this scope
  127 |     lv_demo_widgets();            // OK
      |     ^~~~~~~~~~~~~~~
exit status 1
cannot convert 'lv_disp_t*' {aka '_lv_disp_t*'} to 'lv_disp_drv_t*' {aka '_lv_disp_drv_t*'}

About six months I thought to study LVGL and kept putting off this idea, but as I began to understand, then there were only mistakes and incomprehensible things. I will use the Bodmer libraries and MCUFRIEND_kbv. Goodbye LVGL…

You can either install LVGL v8.3.x from Arduino’s library manager image

or download it from the release/v8.3 branch from GitHub.