Example that shows how to use emWin. This example is based on NXP's POS demo available at lpcware.com

Dependencies:   EALib ewgui mbed

main.cpp

Committer:
embeddedartists
Date:
2014-04-14
Revision:
2:cbf00ac63f35
Parent:
0:2052561807c5

File content as of revision 2:cbf00ac63f35:


/******************************************************************************
 * Includes
 *****************************************************************************/

#include "mbed.h"

#include "sdram.h"

#include "EwGuiImpl.h"



/******************************************************************************
 * Typedefs and defines
 *****************************************************************************/


/******************************************************************************
 * Local variables
 *****************************************************************************/


/******************************************************************************
 * Local functions
 *****************************************************************************/

static EwGuiImpl* gui = NULL;

static void pollTouch() {
    if (gui == NULL) return;

    gui->execTouch();
}

/******************************************************************************
 * Main function
 *****************************************************************************/

int main (void) {

    Ticker ticker;
    
    // Frame buffer is put in SDRAM
    if (sdram_init() == 1) {
        printf("Failed to initialize SDRAM\n");
        return 1;
    }


    // instantiate and initialize GUI
    gui = new EwGuiImpl();

    // calibrate touch screen
    gui->calibrate();
    
    ticker.attach(&pollTouch, 0.05);


    MainTask();

    // application loop running the UI and checking for touch events
    while(1) {
        gui->exec();
        //gui.execTouch();
    }


}