Tuesday, October 17th 2017, 8:02am UTC+2

You are not logged in.

  • Login
  • Register

system32

Beginner

Date of registration: Jul 13th 2017

Posts: 6

1

Tuesday, July 25th 2017, 1:21pm

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.

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 379

2

Thursday, July 27th 2017, 9:29am

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/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
void MainTask(void) {
  GUI_MEMDEV_Handle hMemSrc;
  GUI_MEMDEV_Handle hMemDst;

  GUI_Init();

  hMemSrc = GUI_MEMDEV_Create(0, 0, aBitmap.XSize, aBitmap.YSize);

  hMemDst = GUI_MEMDEV_Create(0, 0, aBitmap.XSize, aBitmap.YSize);

  GUI_MEMDEV_Select(hMemSrc);

  GUI_SetBkColor(GUI_TRANSPARENT);
  GUI_Clear();

  GUI_DrawBitmap(&aBitmap, 0, 0);

  GUI_MEMDEV_Select(0);

  GUI_MEMDEV_RotateHQT(hMemSrc, hMemDst , 0, 0, 90 * 1000, 1 * 1000);

  GUI_MEMDEV_WriteAt(hMemDst, 10, 10);
  while(1) {
	GUI_Delay(500);
  }
}

Quoted

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

system32

Beginner

Date of registration: Jul 13th 2017

Posts: 6

3

Wednesday, September 20th 2017, 7:28pm

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)

https://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 :)

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 379

4

Monday, September 25th 2017, 8:55am

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

system32

Beginner

Date of registration: Jul 13th 2017

Posts: 6

5

Wednesday, September 27th 2017, 9:54am

Thank you Sven, yes, I can see some improvement already. Is there any workaround in guiBuilder to place widgets and texts 90* rotated?


Cheers

This post by "SEGGER - Schoenen" (Wednesday, September 27th 2017, 12:22pm) has been deleted by the author himself (Wednesday, September 27th 2017, 2:42pm).

Similar threads