jkjk Posted March 12, 2014 Report Posted March 12, 2014 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 creationvoid 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 helpfulThanks!
Joel Bodenmann Posted March 13, 2014 Report Posted March 13, 2014 Hello and welcome to the community!That is a well known issue with the ILI932x driver. It looks like there are different revisions of this controller and they require different initialization codes when it comes to the orientation. Sometimes, I myself have seen this, sellers tell you it's an ILI9320 but in fact it's an ILI9325 etc. I had struggled a lot with that controller so far.Things to try: First, Try to use the ILI9325 driver instead. If this does not work, please take a look at the initialization routine of the code example that comes with the display. If necessary, replace the initialization routine in /drivers/gdisp/ILI9320/gdisp_lld_ILI9320.c with the 'new' one (Also check the orientation registers in the control routine).If you have any further questions, do not hesitate to ask!~ Tectu
jkjk Posted March 15, 2014 Author Report Posted March 15, 2014 I got this working.The problem is in the ILI9320 driver fileswap the first register writes for GDISP_ROTATE_90 and GDISP_ROTATE_270 and it should fix the problem.old code:case GDISP_ROTATE_90:acquire_bus(g);write_reg(g, 0x01, 0x0100); #line 331write_reg(g, 0x03, 0x1030);write_reg(g, 0x60, 0x2700);case GDISP_ROTATE_270:acquire_bus(g);write_reg(g, 0x01, 0x0000); #line 353write_reg(g, 0x03, 0x1038);write_reg(g, 0x60, 0xA700);new code:case GDISP_ROTATE_90:acquire_bus(g);write_reg(g, 0x01, 0x0000); #line 331write_reg(g, 0x03, 0x1030);write_reg(g, 0x60, 0x2700);case GDISP_ROTATE_270:acquire_bus(g);write_reg(g, 0x01, 0x0100); #line 353write_reg(g, 0x03, 0x1038);write_reg(g, 0x60, 0xA700);
Joel Bodenmann Posted March 17, 2014 Report Posted March 17, 2014 Thank you very much for finding and reporting this bug. I'll take a look and fix it as soon as possible.~ Tectu
inmarket Posted March 22, 2014 Report Posted March 22, 2014 This has now been updated in the source repository.Thanks for finding this bug.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now