Jump to content

jkjk

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by jkjk

  1. 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:


    case GDISP_ROTATE_90:
    acquire_bus(g);
    write_reg(g, 0x01, 0x0100); #line 331
    write_reg(g, 0x03, 0x1030);
    write_reg(g, 0x60, 0x2700);

    case GDISP_ROTATE_270:
    acquire_bus(g);
    write_reg(g, 0x01, 0x0000); #line 353
    write_reg(g, 0x03, 0x1038);
    write_reg(g, 0x60, 0xA700);

    new code:


    case GDISP_ROTATE_90:
    acquire_bus(g);
    write_reg(g, 0x01, 0x0000); #line 331
    write_reg(g, 0x03, 0x1030);
    write_reg(g, 0x60, 0x2700);

    case GDISP_ROTATE_270:
    acquire_bus(g);
    write_reg(g, 0x01, 0x0100); #line 353
    write_reg(g, 0x03, 0x1038);
    write_reg(g, 0x60, 0xA700);

  2. 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!

×
×
  • Create New...