Wrapper classes for the emwin library
Dependents: app_emwin1 app_emwin2_pos lpc4088_ebb_gui_emwin
EwGui.h@1:0b16165ada7c, 2014-04-14 (annotated)
- Committer:
- embeddedartists
- Date:
- Mon Apr 14 08:38:33 2014 +0000
- Revision:
- 1:0b16165ada7c
- Parent:
- 0:316c181e9b65
Initialize uninitialized touchState in EwGui
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:316c181e9b65 | 1 | |
embeddedartists | 0:316c181e9b65 | 2 | #ifndef EWGUI_H |
embeddedartists | 0:316c181e9b65 | 3 | #define EWGUI_H |
embeddedartists | 0:316c181e9b65 | 4 | |
embeddedartists | 0:316c181e9b65 | 5 | #include "stdint.h" |
embeddedartists | 0:316c181e9b65 | 6 | #include "GUI.h" |
embeddedartists | 0:316c181e9b65 | 7 | |
embeddedartists | 0:316c181e9b65 | 8 | /** |
embeddedartists | 0:316c181e9b65 | 9 | * This is the main class to get Segger's emwin library up-and-running |
embeddedartists | 0:316c181e9b65 | 10 | * with the mbed online tools. |
embeddedartists | 0:316c181e9b65 | 11 | * |
embeddedartists | 0:316c181e9b65 | 12 | * This class handles the porting/integration layer in emwin and the virtual |
embeddedartists | 0:316c181e9b65 | 13 | * methods must be implemented in a sub-class to handle such things as |
embeddedartists | 0:316c181e9b65 | 14 | * memory allocation, framebuffer association, display size, and touch |
embeddedartists | 0:316c181e9b65 | 15 | * events. |
embeddedartists | 0:316c181e9b65 | 16 | * |
embeddedartists | 0:316c181e9b65 | 17 | */ |
embeddedartists | 0:316c181e9b65 | 18 | class EwGui { |
embeddedartists | 0:316c181e9b65 | 19 | public: |
embeddedartists | 0:316c181e9b65 | 20 | |
embeddedartists | 0:316c181e9b65 | 21 | |
embeddedartists | 0:316c181e9b65 | 22 | /** |
embeddedartists | 0:316c181e9b65 | 23 | * Returns the address to a memory block which may be used by emwin |
embeddedartists | 0:316c181e9b65 | 24 | * to allocate objects. The memory block returned will be given to emwin |
embeddedartists | 0:316c181e9b65 | 25 | * by calling GUI_ALLOC_AssignMemory. |
embeddedartists | 0:316c181e9b65 | 26 | */ |
embeddedartists | 0:316c181e9b65 | 27 | virtual void* getMemoryBlockAddress() = 0; |
embeddedartists | 0:316c181e9b65 | 28 | |
embeddedartists | 0:316c181e9b65 | 29 | /** |
embeddedartists | 0:316c181e9b65 | 30 | * Returns the size of the memory block returned by |
embeddedartists | 0:316c181e9b65 | 31 | * getMemoryBlockAddress(). |
embeddedartists | 0:316c181e9b65 | 32 | */ |
embeddedartists | 0:316c181e9b65 | 33 | virtual uint32_t getMemoryBlockSize() = 0; |
embeddedartists | 0:316c181e9b65 | 34 | |
embeddedartists | 0:316c181e9b65 | 35 | /** |
embeddedartists | 0:316c181e9b65 | 36 | * Returns the width of the display. |
embeddedartists | 0:316c181e9b65 | 37 | */ |
embeddedartists | 0:316c181e9b65 | 38 | virtual uint32_t getDisplayWidth() = 0; |
embeddedartists | 0:316c181e9b65 | 39 | |
embeddedartists | 0:316c181e9b65 | 40 | /** |
embeddedartists | 0:316c181e9b65 | 41 | * Returns the height of the display. |
embeddedartists | 0:316c181e9b65 | 42 | */ |
embeddedartists | 0:316c181e9b65 | 43 | virtual uint32_t getDisplayHeight() = 0; |
embeddedartists | 0:316c181e9b65 | 44 | |
embeddedartists | 0:316c181e9b65 | 45 | /** |
embeddedartists | 0:316c181e9b65 | 46 | * Returns the address of the framebuffer (video RAM). This address will |
embeddedartists | 0:316c181e9b65 | 47 | * be given to emwin by a call to LCD_SetVRAMAddrEx. |
embeddedartists | 0:316c181e9b65 | 48 | */ |
embeddedartists | 0:316c181e9b65 | 49 | virtual void* getFrameBufferAddress() = 0; |
embeddedartists | 0:316c181e9b65 | 50 | |
embeddedartists | 0:316c181e9b65 | 51 | /** |
embeddedartists | 0:316c181e9b65 | 52 | * Get touch coordinates (if the display has a touch panel) |
embeddedartists | 0:316c181e9b65 | 53 | * |
embeddedartists | 0:316c181e9b65 | 54 | * @param x the x coordinate |
embeddedartists | 0:316c181e9b65 | 55 | * @param y the y coordinate |
embeddedartists | 0:316c181e9b65 | 56 | * $param z the z coordinate. If the value is > 0 the panel is touched. |
embeddedartists | 0:316c181e9b65 | 57 | */ |
embeddedartists | 0:316c181e9b65 | 58 | virtual void getTouchValues(int32_t* x, int32_t* y, int32_t* z) = 0; |
embeddedartists | 0:316c181e9b65 | 59 | |
embeddedartists | 0:316c181e9b65 | 60 | /** |
embeddedartists | 0:316c181e9b65 | 61 | * Must be called regularly for emwin to work properly |
embeddedartists | 0:316c181e9b65 | 62 | */ |
embeddedartists | 0:316c181e9b65 | 63 | void exec(); |
embeddedartists | 0:316c181e9b65 | 64 | |
embeddedartists | 0:316c181e9b65 | 65 | /** |
embeddedartists | 0:316c181e9b65 | 66 | * Must be called regularly for touch events to be retrieved |
embeddedartists | 0:316c181e9b65 | 67 | */ |
embeddedartists | 0:316c181e9b65 | 68 | void execTouch(); |
embeddedartists | 0:316c181e9b65 | 69 | |
embeddedartists | 0:316c181e9b65 | 70 | /** |
embeddedartists | 0:316c181e9b65 | 71 | * Returns the x coordinate of the latest touch event |
embeddedartists | 0:316c181e9b65 | 72 | */ |
embeddedartists | 0:316c181e9b65 | 73 | int32_t getTouchX() {return _touchX;} |
embeddedartists | 0:316c181e9b65 | 74 | |
embeddedartists | 0:316c181e9b65 | 75 | /** |
embeddedartists | 0:316c181e9b65 | 76 | * Returns the y coordinate of the latest touch event |
embeddedartists | 0:316c181e9b65 | 77 | */ |
embeddedartists | 0:316c181e9b65 | 78 | int32_t getTouchY() {return _touchY;} |
embeddedartists | 0:316c181e9b65 | 79 | |
embeddedartists | 0:316c181e9b65 | 80 | protected: |
embeddedartists | 0:316c181e9b65 | 81 | EwGui(); |
embeddedartists | 0:316c181e9b65 | 82 | void init(); |
embeddedartists | 0:316c181e9b65 | 83 | |
embeddedartists | 0:316c181e9b65 | 84 | private: |
embeddedartists | 0:316c181e9b65 | 85 | |
embeddedartists | 0:316c181e9b65 | 86 | bool _initialized; |
embeddedartists | 0:316c181e9b65 | 87 | bool _penIsDown; |
embeddedartists | 0:316c181e9b65 | 88 | int32_t _touchX; |
embeddedartists | 0:316c181e9b65 | 89 | int32_t _touchY; |
embeddedartists | 0:316c181e9b65 | 90 | GUI_PID_STATE _touchState; |
embeddedartists | 0:316c181e9b65 | 91 | |
embeddedartists | 0:316c181e9b65 | 92 | }; |
embeddedartists | 0:316c181e9b65 | 93 | |
embeddedartists | 0:316c181e9b65 | 94 | #endif |