EmbeddedArtists AB / ewgui

Dependents:   app_emwin1 app_emwin2_pos lpc4088_ebb_gui_emwin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers EwGui.h Source File

EwGui.h

00001 
00002 #ifndef EWGUI_H
00003 #define EWGUI_H
00004 
00005 #include "stdint.h"
00006 #include "GUI.h"
00007 
00008 /**
00009  * This is the main class to get Segger's emwin library up-and-running
00010  * with the mbed online tools.
00011  *
00012  * This class handles the porting/integration layer in emwin and the virtual
00013  * methods must be implemented in a sub-class to handle such things as
00014  * memory allocation, framebuffer association, display size, and touch
00015  * events.
00016  *
00017  */
00018 class EwGui {
00019 public:
00020 
00021 
00022     /**
00023      * Returns the address to a memory block which may be used by emwin
00024      * to allocate objects. The memory block returned will be given to emwin
00025      * by calling GUI_ALLOC_AssignMemory.
00026      */
00027     virtual void* getMemoryBlockAddress() = 0;
00028 
00029     /**
00030      * Returns the size of the memory block returned by
00031      * getMemoryBlockAddress().
00032      */
00033     virtual uint32_t getMemoryBlockSize() = 0;
00034 
00035     /**
00036      * Returns the width of the display.
00037      */
00038     virtual uint32_t getDisplayWidth() = 0;
00039 
00040     /**
00041      * Returns the height of the display.
00042      */
00043     virtual uint32_t getDisplayHeight() = 0;
00044 
00045     /**
00046      * Returns the address of the framebuffer (video RAM). This address will
00047      * be given to emwin by a call to LCD_SetVRAMAddrEx.
00048      */
00049     virtual void* getFrameBufferAddress() = 0;
00050 
00051     /**
00052      * Get touch coordinates (if the display has a touch panel)
00053      *
00054      * @param x the x coordinate
00055      * @param y the y coordinate
00056      * $param z the z coordinate. If the value is > 0 the panel is touched.
00057      */
00058     virtual void getTouchValues(int32_t* x, int32_t* y, int32_t* z) = 0;
00059 
00060     /**
00061      * Must be called regularly for emwin to work properly
00062      */
00063     void exec();
00064 
00065     /**
00066      * Must be called regularly for touch events to be retrieved
00067      */
00068     void execTouch();
00069 
00070     /**
00071      * Returns the x coordinate of the latest touch event
00072      */
00073     int32_t getTouchX() {return _touchX;}
00074 
00075     /**
00076      * Returns the y coordinate of the latest touch event
00077      */
00078     int32_t getTouchY() {return _touchY;}
00079 
00080 protected:
00081     EwGui();
00082     void init();
00083 
00084 private:
00085 
00086     bool _initialized;
00087     bool _penIsDown;
00088     int32_t _touchX;
00089     int32_t _touchY;
00090     GUI_PID_STATE _touchState;
00091 
00092 };
00093 
00094 #endif