Way to Rotate lvgl example?

Hi,

I have been working on a project involving an LCD screen using the LVGL sample as a base. However, it would be nice if I could rotate either the text itself or the screen by 90 degrees. I tried the lv_disp_set _rotation command found in lv_hal_disp.c but rather than rotating the screen it just broke the display. The same thing happens if I flip the width and height in the overlay. 1) is this error some how caused by the lv_disp library and 2) is there a fix for this? I am using the SH1107 OLED which is compatible with the ssd1306 drivers and I am using an unedited version of the lvgl example. Any help would be appreciated.

Thanks!

Parents Reply Children
  • Hi,

    Reading through those right now and working on implementing the little patch thing they are talking about. It's a little hard to describe how the display breaks exactly. It creates a little jumble of letters and numbers to the center right and there are little white streaks across the screen.

    Do you happen to know where the flush callback is in this example?

  • So looking more into it looks like the fixes posted on the LVGL forum are a little outdated. Kconfig.graphical doesn't exist anymore, for example and the fixes in the Zephyr forums don't work in isolation. Still looking into seeing if there is a fix.

  • Hi 

    Have you tried to change the rotation property in the device tree node for the display driver? 

    I believe this is the recommended way to set the orientation of the display. 

    Best regards
    Torbjørn

  • I tried to but I was under them impression from research that there wasn't a rotation property. Can I just set that in the overlay?

  • Hi 

    Can you check the zephyr.dts file in the build/zephyr directory? 

    This file will contain the complete device tree configuration, after all board files, overlays etc has been compiled. 

    As an example, if I build the display/lvgl sample I can find the display node under spi3, and see that it includes the rotation property:

    ili9340: ili9340@0 {
    		compatible = "ilitek,ili9340";
    		spi-max-frequency = < 0xe7319b >;
    		reg = < 0x0 >;
    		cmd-data-gpios = < &arduino_header 0xf 0x1 >;
    		width = < 0x140 >;
    		height = < 0xf0 >;
    		pixel-format = < 0x1 >;
    		rotation = < 0x5a >;
    		frmctr1 = [ 00 18 ];
    		pwctrl1 = [ 23 00 ];
    		vmctrl1 = [ 3E 28 ];
    		vmctrl2 = [ 86 ];
    		pgamctrl = [ 0F 31 2B 0C 0E 08 4E F1 37 07 10 03 0E 09 00 ];
    		ngamctrl = [ 00 0E 14 03 11 07 31 C1 48 08 0F 0C 31 36 0F ];
    	};

    You should be able to change this property through the overlay, yes. 

    Once the project gets more mature I would recommend making your own board definition, rather than relying on overlays. 

    Best regards
    Torbjørn

Related