Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: LVGL on Teensy 4: Upgrade to v8

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Location
    Mclean VA -- West of DC
    Posts
    12

    LVGL on Teensy 4: Upgrade to v8

    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.

  2. #2
    Senior Member
    Join Date
    Jan 2015
    Location
    UK
    Posts
    166
    There are big difference in v7 to v8:
    https://forum.lvgl.io/t/how-to-upgra...7-to-v8/6248/2

    For the time being I would stick with v7 until a later date.

  3. #3
    Junior Member
    Join Date
    Feb 2021
    Location
    Mclean VA -- West of DC
    Posts
    12
    @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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •