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

Committer:
alindvall
Date:
Tue Apr 28 11:52:32 2015 +0000
Revision:
3:19cbcaa84dd0
Parent:
0:36d07e98a5b2
Updated to latest version of the DMSupport library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
alindvall 0:36d07e98a5b2 1 #include "mbed.h"
alindvall 0:36d07e98a5b2 2 #include "DMBoard.h"
alindvall 0:36d07e98a5b2 3 #include "EwHAL.h"
alindvall 0:36d07e98a5b2 4 #include "WM.h"
alindvall 0:36d07e98a5b2 5
alindvall 0:36d07e98a5b2 6 void MainTask(void);
alindvall 0:36d07e98a5b2 7
alindvall 0:36d07e98a5b2 8 int main()
alindvall 0:36d07e98a5b2 9 {
alindvall 0:36d07e98a5b2 10 DMBoard::BoardError err;
alindvall 0:36d07e98a5b2 11 DMBoard* board = &DMBoard::instance();
alindvall 0:36d07e98a5b2 12 RtosLog* log = board->logger();
alindvall 0:36d07e98a5b2 13 Display* disp = board->display();
alindvall 0:36d07e98a5b2 14
alindvall 0:36d07e98a5b2 15 do {
alindvall 0:36d07e98a5b2 16 err = board->init();
alindvall 0:36d07e98a5b2 17 if (err != DMBoard::Ok) {
alindvall 0:36d07e98a5b2 18 log->printf("Failed to initialize the board, got error %d\r\n", err);
alindvall 0:36d07e98a5b2 19 break;
alindvall 0:36d07e98a5b2 20 }
alindvall 0:36d07e98a5b2 21
alindvall 0:36d07e98a5b2 22 log->printf("\n\nHello World!\n\n");
alindvall 0:36d07e98a5b2 23
alindvall 0:36d07e98a5b2 24 // Create the HAL for emWin
alindvall 0:36d07e98a5b2 25 // - Use 3 frame buffers for tripple-buffering
alindvall 0:36d07e98a5b2 26 // - Allow emWin to use 12MByte of external SDRAM
alindvall 0:36d07e98a5b2 27 EwHAL hal(3, 12*1024*1024);
alindvall 0:36d07e98a5b2 28
alindvall 0:36d07e98a5b2 29 // Start display in default mode (16-bit)
alindvall 0:36d07e98a5b2 30 Display::DisplayError disperr = disp->powerUp(hal.getFrameBufferAddress());
alindvall 0:36d07e98a5b2 31 if (disperr != Display::DisplayError_Ok) {
alindvall 0:36d07e98a5b2 32 log->printf("Failed to initialize the display, got error %d\r\n", disperr);
alindvall 0:36d07e98a5b2 33 break;
alindvall 0:36d07e98a5b2 34 }
alindvall 0:36d07e98a5b2 35
alindvall 0:36d07e98a5b2 36 // Add extra options here
alindvall 0:36d07e98a5b2 37 // - Set WM_CF_MEMDEV option to use "Memory Devices" to reduce flickering
alindvall 0:36d07e98a5b2 38 WM_SetCreateFlags(WM_CF_MEMDEV);
alindvall 0:36d07e98a5b2 39
alindvall 0:36d07e98a5b2 40 // Execute the emWin example and never return...
alindvall 0:36d07e98a5b2 41 MainTask();
alindvall 0:36d07e98a5b2 42 } while(false);
alindvall 0:36d07e98a5b2 43
alindvall 0:36d07e98a5b2 44 mbed_die();
alindvall 0:36d07e98a5b2 45 }