How to rotate display - ili9341 lvgl esp32-wrover-kit


I am trying tests/pkg_lvgl on esp32-wrover-kit, the test works perfect but the display shows upside-down for me.

Could anyone tell me how can I rotate the display 180 degrees. As far as I remember the lv_port-esp32 has a configuration option for rotating the display but I couldn’t find how to make it.

Thanks in advance, Murat

Hi @ta1db, first of all, welcome to RIOT!

I haven’t used LVGL that much but If I’m not mistaking your question is related to LVGL API itself and not RIOT, I don’t have a BOARD to test at the moment but could it be related to So either at runtime try lv_disp_set_rotation(disp, rot) or initialization directly on lv_disp_drv_t disp_drv set the rotated parameter.

Hi Francisco,

Thank you very much for your warm welcome and for the kind answer.

I could easily made 180 degrees software rotation by adding “disp_drv.sw_rotate=1;” into “void lvgl_init(screen_dev_t *screen_dev)” function in “RIOT/pkg/lvgl/lvgl.c”, and calling “lv_disp_set_rotation(NULL, LV_DISP_ROT_180) at “int main(void)” in RIOT/tests/pkg_lvgl/main.c”. However memory consumption is 87%, CPU load is 53% with just this test.

I think there should be a more convenient and economical way of turning display upside-down. I am trying to make this rotation inside of display controller (if possible) or in the driver or at least in the initialization but I couldn’t succeed any of them yet :slight_smile: I am working…

With best regards,


Hardware solution:

Simply change

/* Memory access CTL */
command_params[0] = ILI9341_MADCTL_HORZ_FLIP;


command_params[0] = ILI9341_MADCTL_HORZ;

in RIOT/drivers/ili9341/ili9341.c

BR, Murat

1 Like

@ta1db See this Pull-Request which adds the rotation mode for ILI9341, so you don’t have to modify the driver, code, let me know if it helps!


Hi @jeandudey

Thank you for your attention and contribution. This is indeed a much better solution for everybody. I am on a trip and far from my workshop therefore I can’t try your PR but I guess it’s OK.

Regards, Murat

1 Like