emWin : GUI_SetOrientation() issue - Memory related?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • emWin : GUI_SetOrientation() issue - Memory related?

      Good day all,
      I am using the NXP I.MXRT1064-EVK for some screen prototyping with the following constraints/features:
      - Using precompiled emWin from NXP. - Interesting note, LCD_GetNumLayers() always returns 1.
      - Using a ST7789 display driver (320x240, 16bits per pixel)
      - emWin is working, I am able to write text/draw images/create graphs on the display.
      - One screen buffer should be a total of 153,000 bytes.
      - I have a total of 350,000 bytes declared as part of GUI_NUMBYTES.
      - I have GUI_BUFFERS of 2
      When calling GUI_SetOrientation() I am getting a return value of 1. Which by the documentation, looks to be a failure.
      From trawling the web, I am seeing this usually occurs when emWin has not been given enough memory as GUI_SetOrientation creates a new frame. I am sure I have declared more than enough memory for the two frames however I am still receiving this error.

      Thank you!
    • Hi,

      Yes, the function GUI_SetOrientation() creates a memory device in the background which gets used to rotate the content of the display. Of course, this device requires some memory.

      The better way is to rotate by selecting a rotated version of the driver.

      With the GUIDRV_FlexColor driver you can rotate by setting the rotation when initializing the driver. For example:

      C Source Code

      1. Config.Orientation = LCD_SWAP_XY | LCD_MIRROR_X;
      2. GUIDRV_FlexColor_Config(pDevice, &Config);

      ChrisLingwoodKromek wrote:

      - I have GUI_BUFFERS of 2
      This has no effect for the GUIDRV_FlexColor driver. The number of buffers is for multi buffering which is only available for the GUIDRV_Lin driver.

      With GUIDRV_FlexColor you can select a chached version of the driver (last paramter needs a 1 in its name):

      GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66709, GUIDRV_FLEXCOLOR_M16C1B16);

      Please note, that the memory for the cache gets allocated from the memory assign to emWin in GUI_X_Config().

      Regards,
      Sven