Emwin Multi Buffer Not Working

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

  • Emwin Multi Buffer Not Working

    Hi I'm new to emwin and I'm using an evaluation version with a custom FPGA LCD controller. I have emwin up and running with no problems except I can not get multi buffers to function. emwin always writes into the first buffer. It never calls LCD_SHOW_BUFFER or fb_copy(). I believe that I have setup emwin correctly according the manual, but I'm obviously missing something.
    To keep things simple so far I'm not using any advanced features of the FPGA which can work as a memory mapped device etc. I simply access all display operations using FPGA registers to read and write the frame buffers. Here is my multi buffer setup code:
    #1 in LCD configure

    void LCD_X_Config(void)
    {
    GUI_MULTIBUF_Config(2);
    GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, COLOR_CONVERSION, 0, 0);
    LCD_SetDevFunc(0, LCD_DEVFUNC_COPYBUFFER, (void (*)())fb_copy);
    LCD_SetSizeEx (0, 800, 480);
    LCD_SetVSizeEx (0, 800, 480);
    }

    #2 GUI task setup (WM auto or manual mode tests (neither do anything))
    in GUItask (auto WM use):
    void GUITask(void* parameters)
    {
    int i;
    GUI_Init();
    WM_MULTIBUF_Enable(1);
    ...
    or
    in GUItask (manual use create a dialog):
    GUI_MULTIBUF_Begin();
    GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0);
    GUI_MULTIBUF_End();

    Since the copy buffer and show buffer functions never get called at all there is no reason to describe them now.

    I am assuming that with an indirect interface (the way I'm currently using emwin) that a "switch" to the "back buffer" would be done via a call to LCD_X_SETORG. This function is called only once during init(). Here is the code for that:

    }
    case LCD_X_SETORG: {
    //
    // Required for setting the display origin which is passed in the 'xPos' and 'yPos' element of p
    //
    //pusFBUF is a pointer to the base of frame buffer n used by the driver
    LCD_X_SETORG_INFO * p;
    p = (LCD_X_SETORG_INFO *)pData;
    pusFBUF = (unsigned short *)(FPGA_FBUF_BASE0 + p->yPos);
    return 0;
    }

    What I know:
    - multibuffer functions (i.e. SHOW_BUFFER, fb_copy()) NEVER get called when WM_MULTIBUF_Enable(1);
    - multibuffer functions NEVER get called when I call GUI_MULTIBUF_Begin() and GUI_MULTIBUF_End()
    - a call to LCD_X_DisplayDriver() of LCD_X_SETORG only occurs once during GUI_Init() with x = y = 0
    - the X,Y values used when calling the driver are always within the bounds of one frame buffer (just as one would assume)

    My questions are:
    1) How does emwin "switch" to the back buffer? Am I correct in my assumption it calls SETORG?
    2) What is wrong with my multi-buffer configuration that causes emwin to ignore it completely?

    Any input would be greatly appreciated, Thanks in advance.