TouchScreen orientation and GUI_MEMDEV_RotateHQT

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

  • TouchScreen orientation and GUI_MEMDEV_RotateHQT

    Hello!

    I'm new here, thank you so much for developing such an amazing product.

    I have few questions:

    I'm on stm32f429i discorvery, everything is working fine, but when I try to rotate the screen using driver "#define DISPLAY_DRIVER_0 GUIDRV_LIN_OSX_32", the touch detection is messed up (rotated). I have tried to use following in my main:


    /* Init the STemWin GUI Library */
    U32 TouchOrientation;
    TouchOrientation = (GUI_MIRROR_X * LCD_GetMirrorX()) |
    (GUI_MIRROR_Y * LCD_GetMirrorY()) |
    (GUI_SWAP_XY * LCD_GetSwapXY()) ;
    GUI_TOUCH_SetOrientation(TouchOrientation);

    GUI_Init();
    GUI_Initialized = 1;

    /* Activate the use of memory device feature */
    WM_SetCreateFlags(WM_CF_MEMDEV);

    but that doesn't seem to do the trick.

    Second thing is, I export the transparent bitmaps in .c format using bitmapconverter. I load them and rotate in such a way:


    GUI_MEMDEV_Select(src2);
    GUI_Clear();
    GUI_SetBkColor(GUI_TRANSPARENT);
    GUI_DrawBitmap(&bmblat1_pod,0,0);
    GUI_MEMDEV_RotateHQ(src2,hDst ,17,115,-90*1000,1*1000);

    That produces good result. But I have read the documentation and there is such a function "GUI_MEMDEV_RotateHQT" optimised for bitmaps with transparent pixels (seems like a great deal for me), but once I change the function to "GUI_MEMDEV_RotateHQT" the program goes into infinite loop handler. Here is my GUIconf:


    #define GUI_NUMBYTES ((1024) * 1500)

    #define GUI_BUFFER_IN_EXT_RAM 1
    #define GUI_BUFFER_ADDRESS 0xD0900000
    #define OS_SUPPORT 1

    Could you please give me some advice on this? Also can I draw .dta files containing transparent pixels instead of .c bitmaps? Will it be faster (the file size seem to be smaller)? Thank you again for delivering such a great product.
  • Hi,

    Unfortunately, GUI_TOUCH_SetOrientation() works only with analog touch input where raw A/D converter values are getting passed to emWin.

    In your case you have to re-calculate the pixel coordinates on your own.

    I checked the function GUI_MEMDEV_RotateHQT(), it is working as expected.

    What is the size of the memory devices you are using?

    Keep in mind that a memory device requires some amount of memory and it can be possible that you exceed the limits quite fast. But I think this not the reason in this case. Even two memory devices with a size of 320 x 240 pixel would require 600KB which should fit easily into the GUI memory.

    Please try the code below (change 'aBitmap' into the bitmap you want to draw):

    C Source Code

    1. void MainTask(void) {
    2. GUI_MEMDEV_Handle hMemSrc;
    3. GUI_MEMDEV_Handle hMemDst;
    4. GUI_Init();
    5. hMemSrc = GUI_MEMDEV_Create(0, 0, aBitmap.XSize, aBitmap.YSize);
    6. hMemDst = GUI_MEMDEV_Create(0, 0, aBitmap.XSize, aBitmap.YSize);
    7. GUI_MEMDEV_Select(hMemSrc);
    8. GUI_SetBkColor(GUI_TRANSPARENT);
    9. GUI_Clear();
    10. GUI_DrawBitmap(&aBitmap, 0, 0);
    11. GUI_MEMDEV_Select(0);
    12. GUI_MEMDEV_RotateHQT(hMemSrc, hMemDst , 0, 0, 90 * 1000, 1 * 1000);
    13. GUI_MEMDEV_WriteAt(hMemDst, 10, 10);
    14. while(1) {
    15. GUI_Delay(500);
    16. }
    17. }
    Display All

    Also can I draw .dta files containing transparent pixels instead of .c
    bitmaps? Will it be faster (the file size seem to be smaller)?
    dta-files are the same as c bitmap file. But instead of c code they are stored in a binary form. Their intention is to be placed on external memory (like an SD card). The drawing process itself is as fast as c-bitmaps but the they need get loaded from the memory first which will make the whole process slower.

    You should stick to c-files if want a fast output.

    Choose the format you are saving the bitmap in according to your LCDConf.c.

    Depending on the color conversion (GUICC_xxx) you should save the bitmap in the proper format:

    GUICC_M8888I - 'True color with alpha, alpha inverted, red and blue swapped'
    GUICC_M565 - 'High color (565), red and blue swapped'

    The same is true for dta-files, if you have an external memory to read from.

    Regards,
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Thank you very much for the info Sven!

    I have one more question, is this the kind of performance that I should get or am I doing something wrong? (the clock is set to 180mhz - if I slightly overclock it goes little bit more smooth)

    youtu.be/HXnnclIkvdc


    Or have I something about DMA2D configured not right what do you think?

    I also plan to change the screen to 7" with an SSD1963 controller, can you tell me if I won't have problems with transparency (using GUIDRV_FlexColor and 18bit interface)?

    Thanks again, this forum is very helpful :)
  • Hi,

    Unfortunately, you have to use the default orientation to get the full advantage of the DMA2D.
    Only the copy buffer functionality is working in a rotated orientation. This is due to hardware limitation.

    Regards,
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.