Support for the emWin GUI library from Segger.

Dependents:   lpc4088_displaymodule_emwin

This 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.

The high performance emWin embedded graphics library developed by SEGGER Microcontroller is now offered by NXP Semiconductors in library form for free commercial use with NXP microcontrollers.

For a better description of what is included and the limitations, see emWin Graphics Library.

Note

The emWin library and PNG support files must be downloaded as the downloaders contains the license info. The steps are described in the readme.h file.

Committer:
alindvall
Date:
Fri Feb 27 11:39:47 2015 +0000
Revision:
0:582739e02e4d
First version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
alindvall 0:582739e02e4d 1
alindvall 0:582739e02e4d 2 #ifndef EWHAL_H
alindvall 0:582739e02e4d 3 #define EWHAL_H
alindvall 0:582739e02e4d 4
alindvall 0:582739e02e4d 5 #include "mbed.h"
alindvall 0:582739e02e4d 6 #include "DMBoard.h"
alindvall 0:582739e02e4d 7
alindvall 0:582739e02e4d 8 /**
alindvall 0:582739e02e4d 9 * This is the main class to get Segger's emwin library up-and-running
alindvall 0:582739e02e4d 10 * with the mbed online tools.
alindvall 0:582739e02e4d 11 *
alindvall 0:582739e02e4d 12 * This class handles the porting/integration layer in emwin.
alindvall 0:582739e02e4d 13 */
alindvall 0:582739e02e4d 14 class EwHAL {
alindvall 0:582739e02e4d 15 public:
alindvall 0:582739e02e4d 16
alindvall 0:582739e02e4d 17 EwHAL(int numFB = 1, uint32_t extraMem = 1*1024*1024);
alindvall 0:582739e02e4d 18 ~EwHAL();
alindvall 0:582739e02e4d 19
alindvall 0:582739e02e4d 20 /**
alindvall 0:582739e02e4d 21 * Returns the address to a memory block which may be used by emwin
alindvall 0:582739e02e4d 22 * to allocate objects. The memory block returned will be given to emwin
alindvall 0:582739e02e4d 23 * by calling GUI_ALLOC_AssignMemory.
alindvall 0:582739e02e4d 24 */
alindvall 0:582739e02e4d 25 void* getMemoryBlockAddress() { return (void*)_mem; }
alindvall 0:582739e02e4d 26
alindvall 0:582739e02e4d 27 /**
alindvall 0:582739e02e4d 28 * Returns the size of the memory block returned by
alindvall 0:582739e02e4d 29 * getMemoryBlockAddress().
alindvall 0:582739e02e4d 30 */
alindvall 0:582739e02e4d 31 uint32_t getMemoryBlockSize() { return _memSz; }
alindvall 0:582739e02e4d 32
alindvall 0:582739e02e4d 33 /**
alindvall 0:582739e02e4d 34 * Returns the width of the display.
alindvall 0:582739e02e4d 35 */
alindvall 0:582739e02e4d 36 uint32_t getDisplayWidth() { return _width; }
alindvall 0:582739e02e4d 37
alindvall 0:582739e02e4d 38 /**
alindvall 0:582739e02e4d 39 * Returns the height of the display.
alindvall 0:582739e02e4d 40 */
alindvall 0:582739e02e4d 41 uint32_t getDisplayHeight() { return _height; }
alindvall 0:582739e02e4d 42
alindvall 0:582739e02e4d 43 /**
alindvall 0:582739e02e4d 44 * Returns the address of the framebuffer (video RAM). This address will
alindvall 0:582739e02e4d 45 * be given to emwin by a call to LCD_SetVRAMAddrEx.
alindvall 0:582739e02e4d 46 */
alindvall 0:582739e02e4d 47 void* getFrameBufferAddress() { return (void*)_fb; }
alindvall 0:582739e02e4d 48
alindvall 0:582739e02e4d 49 /**
alindvall 0:582739e02e4d 50 * Returns the size in bytes of the framebuffer (video RAM).
alindvall 0:582739e02e4d 51 */
alindvall 0:582739e02e4d 52 uint32_t getFrameBufferSize() { return _fbSz; }
alindvall 0:582739e02e4d 53
alindvall 0:582739e02e4d 54 /**
alindvall 0:582739e02e4d 55 * Returns the number of frame buffers to use, default is 1 meaning
alindvall 0:582739e02e4d 56 * that drawing takes place on the same buffer that is being shown.
alindvall 0:582739e02e4d 57 * Double buffering is 2 and Tripple buffering is 3. No other values
alindvall 0:582739e02e4d 58 * should be used.
alindvall 0:582739e02e4d 59 */
alindvall 0:582739e02e4d 60 int getNumFrameBuffers() { return _numFB; }
alindvall 0:582739e02e4d 61
alindvall 0:582739e02e4d 62 /**
alindvall 0:582739e02e4d 63 * Shows frame buffer number id. If getNumFrameBuffers() returns 1 then
alindvall 0:582739e02e4d 64 * this id will always be 0, if getNumFrameBuffers() returns N then this
alindvall 0:582739e02e4d 65 * function will be called with 0..(N-1).
alindvall 0:582739e02e4d 66 */
alindvall 0:582739e02e4d 67 void showFrameBuffer(int id);
alindvall 0:582739e02e4d 68
alindvall 0:582739e02e4d 69 /**
alindvall 0:582739e02e4d 70 * Returns the x coordinate of the latest touch event
alindvall 0:582739e02e4d 71 */
alindvall 0:582739e02e4d 72 int32_t getTouchX() {return _coord.x;}
alindvall 0:582739e02e4d 73
alindvall 0:582739e02e4d 74 /**
alindvall 0:582739e02e4d 75 * Returns the y coordinate of the latest touch event
alindvall 0:582739e02e4d 76 */
alindvall 0:582739e02e4d 77 int32_t getTouchY() {return _coord.y;}
alindvall 0:582739e02e4d 78
alindvall 0:582739e02e4d 79
alindvall 0:582739e02e4d 80 private:
alindvall 0:582739e02e4d 81
alindvall 0:582739e02e4d 82 /**
alindvall 0:582739e02e4d 83 * Called when a new touch event is available. Reads the coordinates and
alindvall 0:582739e02e4d 84 * forwards them to emWin
alindvall 0:582739e02e4d 85 */
alindvall 0:582739e02e4d 86 void handleTouchEvent();
alindvall 0:582739e02e4d 87
alindvall 0:582739e02e4d 88 int _numFB;
alindvall 0:582739e02e4d 89 FunctionPointer* _fp;
alindvall 0:582739e02e4d 90 uint32_t _width;
alindvall 0:582739e02e4d 91 uint32_t _height;
alindvall 0:582739e02e4d 92 uint32_t _fb;
alindvall 0:582739e02e4d 93 uint32_t _fbSz;
alindvall 0:582739e02e4d 94 uint32_t _mem;
alindvall 0:582739e02e4d 95 uint32_t _memSz;
alindvall 0:582739e02e4d 96 Display* _display;
alindvall 0:582739e02e4d 97 TouchPanel* _touch;
alindvall 0:582739e02e4d 98 touch_coordinate_t _coord;
alindvall 0:582739e02e4d 99 };
alindvall 0:582739e02e4d 100
alindvall 0:582739e02e4d 101 #endif
alindvall 0:582739e02e4d 102