jkjk
-
Posts
2 -
Joined
-
Last visited
Content Type
Forums
Store
Downloads
Blogs
Posts posted by jkjk
-
-
Hi all,
I am using the driver for ILI9320 on a STM32F4 Discovery board.
I have this problem that whenever I try to change the screen orientation, say by 90 degrees, the button and widgets will be rotate correctly. But the letters in the labels, button will become unreadable as they are flipped and mirrored. I've tried upgrading to the latest version of ugfx and this problem is still there.
here is part of the code that deals with the orientation and button creation
void startup_page(void) {
GWidgetInit wi;
coord_t swidth,sheight;
swidth = gdispGetWidth();
sheight = gdispGetHeight();
// Apply some default values for GWIN
wi.customDraw = 0;
wi.customParam = 0;
wi.customStyle = 0;
wi.g.show = TRUE;
// create the first image widget
wi.g.x = 0; wi.g.y = 10; wi.g.width = swidth; wi.g.height = sheight;
ghImage1 = gwinImageCreate(NULL, &wi.g);
gwinImageOpenMemory(ghImage1, logo);
int i = 0;
while (i < 5000){
wait1ms();
i++;
}
//Home_Page()Widgets
wi.g.width = (swidth-40)/3;
wi.g.height = 30;
wi.g.y = sheight/2;
wi.g.x = 10;
wi.text = "Send";
ghSend = gwinButtonCreate(NULL, &wi);
gwinSetVisible(ghSend, FALSE);
gwinSetEnabled(ghSend, FALSE);
wi.g.x = 20+(swidth-40)/3;
wi.text = "Receive";
ghReceive = gwinButtonCreate(NULL, &wi);
gwinSetVisible(ghReceive, FALSE);
gwinSetEnabled(ghReceive, FALSE);
home_page();
}
void home_page(void){
destroy_widgets(prev_page);
prev_page = BTN_Home;
gwinSetVisible(ghSend, TRUE);
gwinSetEnabled(ghSend, TRUE);
gwinSetVisible(ghReceive, TRUE);
gwinSetEnabled(ghReceive, TRUE);
}
void initUserInterface(void)
{
gwinSetDefaultFont(gdispOpenFont("UI1"));
gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE);
ginputSetMouseCalibrationRoutines(0, mysave, myload, FALSE);
gdispClear(Black);
gwinAttachMouse(0);
gdispSetOrientation(GDISP_ROTATE_90);
startup_page();
geventListenerInit(&gl);
gwinAttachListener(&gl);
}In this case, the words "Send" and "Receive" on the two buttons would be flipped and mirror such that it is unreadable.
Any suggestion is helpful
Thanks!
Changing screen orientation makes letter unreadable
in Support
Posted
I got this working.
The problem is in the ILI9320 driver file
swap the first register writes for GDISP_ROTATE_90 and GDISP_ROTATE_270 and it should fix the problem.
old code:
new code: