Example program using the emWin GUI library.

Dependencies:   DMSupport DMemWin

This program shows how to use the emWin graphical library on the display modules.

The DMemWin library contains the porting layer needed to start working with emWin from Segger. Details about emWin can be found both segger.com as well as lpcware.com.

Warning

There are limitations on how the emWin library may be distributed and republished so it is not a part of this example. To get the code to compile follow the instructions in readme.h.

This project can be selected as a template when creating a new project based on the LPC4088 Display Module.

Information

This project can work on both the 4.3" and 5" display modules but it is completely dependant on which project is choosen from the Segger emWin samples page.

This project uses the Ticker Sample but it can be replaced by one from the Segger emWin samples page. However some of the samples use features that are not supported or use too high resolutions.

This is what it looks like when using the Ticker Sample:

/media/uploads/embeddedartists/emwin_cap_000.png /media/uploads/embeddedartists/emwin_cap_001.png /media/uploads/embeddedartists/emwin_cap_002.png

main.cpp

Committer:
alindvall
Date:
2015-04-28
Revision:
3:19cbcaa84dd0
Parent:
0:36d07e98a5b2

File content as of revision 3:19cbcaa84dd0:

#include "mbed.h"
#include "DMBoard.h"
#include "EwHAL.h"
#include "WM.h"

void MainTask(void);

int main()
{
  DMBoard::BoardError err;
  DMBoard* board = &DMBoard::instance();
  RtosLog* log = board->logger();
  Display* disp = board->display();
  
  do {
    err = board->init();
    if (err != DMBoard::Ok) {
      log->printf("Failed to initialize the board, got error %d\r\n", err);
      break;
    }
    
    log->printf("\n\nHello World!\n\n");
    
    // Create the HAL for emWin
    // - Use 3 frame buffers for tripple-buffering
    // - Allow emWin to use 12MByte of external SDRAM
    EwHAL hal(3, 12*1024*1024);
    
    // Start display in default mode (16-bit)
    Display::DisplayError disperr = disp->powerUp(hal.getFrameBufferAddress());
    if (disperr != Display::DisplayError_Ok) {
      log->printf("Failed to initialize the display, got error %d\r\n", disperr);
      break;
    }
    
    // Add extra options here
    // - Set WM_CF_MEMDEV option to use "Memory Devices" to reduce flickering
    WM_SetCreateFlags(WM_CF_MEMDEV);
    
    // Execute the emWin example and never return...
    MainTask();
  } while(false);
  
  mbed_die();
}