LVGL on Teensy 4: Upgrade to v8

Status
Not open for further replies.

Bewing

Member
This for SKPang (I’d be grateful if you could send me a message: bewing2@gmail.com .)

I'm doing LVGL on Teensy 4.0; ILI9488, 480x320 SPI LCD. Everything was going swimmingly under LVGL v7.11, but yesterday I allowed Arduino to upgrade to v8.0.2. Of course everything broke -- a series of compiler errors which are getting more difficult to address. It's unclear to me, SKPang, which parts of your v7 code I need to keep, which to update (e.g., all or parts of lv_conf.h) I’ve never ported a graphics subsystem but I’ve given it a little thought and I’d expect it to be reasonably portable, even across major versions.

I’ll be happy to publish working lvgl code public if we get there.
I can hassle through the errors but first I thought I’d ask the experts if this will be fruitful or if it’s a huge job best left to the likes of … you – in which case, I’ll revert to v7.11 and move on.

I don't want to post "complete source code" or compiler errors -- it's just way too much. If it helps, here are snippets of current compilation errors:

1) It can’t find the default font:

# define LV_FONT_DEFAULT &lv_font_montserrat_14
^ (points to lv_font_montserrat_14
MetronomeApp.cpp:16: error: #include expects "FILENAME" or <FILENAME>
#include LV_THEME_DEFAULT_INCLUDE
^
I saw a note saying to be sure everything is defined in lv_conf.h. I'll start searching there for this one

2) The next 3 errors might be more pernicious. Some #include file linking the driver missing? Or is it just dropping the leading “lv_”? :

R:\QTRNM-QFSV\Teensy\LCD\LCD.ino: At global scope:
LCD:38: error: 'lv_disp_buf_t' does not name a type
static lv_disp_buf_t disp_buf;
^
LCD: In function 'void setup()':
LCD:132: error: 'disp_buf' was not declared in this scope
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * LV_VER_RES_MAX / 10);
^
LCD:132: error: 'lv_disp_buf_init' was not declared in this scope
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * LV_VER_RES_MAX / 10);
^
LCD:139: error: 'lv_disp_drv_t {aka struct _lv_disp_drv_t}' has no member named 'buffer'
disp_drv.buffer = &disp_buf;

Again, thanks. Your insights greatly appreciated.
 
@skpang : Thank you very much for writing. I decided to go ahead with porting to LVGL V8.02. I now have the basics working -- SPI serial driver and resistive touchscreen, all built on your (life-saving!) code. I want to point out a crucial issue that took me a long time to debug, and which you ought to know and correct before it causes you problems... Here's a snippet from your original "setup()" code:

Code:
   ...
    lv_init();
    lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 40);
    
    lv_disp_drv_t disp_drv;
    lv_disp_drv_init(&disp_drv);
    disp_drv.hor_res = screenWidth;
    disp_drv.ver_res = screenHeight;
    disp_drv.flush_cb = my_disp_flush;
    disp_drv.buffer = &disp_buf;
    lv_disp_drv_register(&disp_drv);

    lv_indev_drv_t indev_drv;
    lv_indev_drv_init(&indev_drv);             /*Descriptor of a input device driver*/
    indev_drv.type = LV_INDEV_TYPE_POINTER;    /*Touch pad is a pointer-like device*/
    indev_drv.read_cb = my_touchpad_read;      /*Set your driver function*/
    lv_indev_drv_register(&indev_drv);         /*Finally register the driver*/
    ...

The issue is that disp_drv and indev_drv are defined inside setup(), thus they are defined on the stack and disappear when setup() closes. These, however, must remain accessible to lvgl. The simple fix is to move the definitions to global scope (where they can be made static.) (It's a wonder it ever worked! Why does it particularly crap out in v8.0?)

I'd still like to collaborate with you on a renewed Teensy40_LittlevGL_ILI9488_demo_create. Of course, you can take almost all the credit -- the Teensy world is waiting!
 
Status
Not open for further replies.
Back
Top