EmbeddedArtists AB
/
app_lcdboard_demo_globe
Example for the LPC4088 QSB Base Board
GlobeDemo.h@1:6131a78e7e97, 2014-04-09 (annotated)
- Committer:
- embeddedartists
- Date:
- Wed Apr 09 09:46:04 2014 +0000
- Revision:
- 1:6131a78e7e97
- Parent:
- 0:7dd43900b657
Updated to latest version of EALib
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:7dd43900b657 | 1 | |
embeddedartists | 0:7dd43900b657 | 2 | #ifndef GLOBEDEMO_H |
embeddedartists | 0:7dd43900b657 | 3 | #define GLOBEDEMO_H |
embeddedartists | 0:7dd43900b657 | 4 | |
embeddedartists | 0:7dd43900b657 | 5 | #include "Graphics.h" |
embeddedartists | 0:7dd43900b657 | 6 | #include "GFXFb.h" |
embeddedartists | 0:7dd43900b657 | 7 | |
embeddedartists | 0:7dd43900b657 | 8 | class GlobeDemo { |
embeddedartists | 0:7dd43900b657 | 9 | public: |
embeddedartists | 0:7dd43900b657 | 10 | |
embeddedartists | 0:7dd43900b657 | 11 | /** Set the address of the frame buffer to use. |
embeddedartists | 0:7dd43900b657 | 12 | * |
embeddedartists | 0:7dd43900b657 | 13 | * It is the content of the frame buffer that is shown on the |
embeddedartists | 0:7dd43900b657 | 14 | * display. All the drawing on the frame buffer can be done |
embeddedartists | 0:7dd43900b657 | 15 | * 'offline' and whenever it should be shown this function |
embeddedartists | 0:7dd43900b657 | 16 | * can be called with the address of the offline frame buffer. |
embeddedartists | 0:7dd43900b657 | 17 | * |
embeddedartists | 0:7dd43900b657 | 18 | * @param pFrameBuf Pointer to the frame buffer, which must be |
embeddedartists | 0:7dd43900b657 | 19 | * 3 times as big as the frame size (for tripple |
embeddedartists | 0:7dd43900b657 | 20 | * buffering). |
embeddedartists | 0:7dd43900b657 | 21 | * dispWidth The width of the display (in pixels). |
embeddedartists | 0:7dd43900b657 | 22 | * dispHeight The height of the display (in pixels). |
embeddedartists | 0:7dd43900b657 | 23 | * loops Number of loops in the demo code. |
embeddedartists | 0:7dd43900b657 | 24 | * delayMs Delay in milliseconds between schreen updates. |
embeddedartists | 0:7dd43900b657 | 25 | * |
embeddedartists | 0:7dd43900b657 | 26 | * @returns |
embeddedartists | 0:7dd43900b657 | 27 | * none |
embeddedartists | 0:7dd43900b657 | 28 | */ |
embeddedartists | 0:7dd43900b657 | 29 | GlobeDemo(uint8_t *pFrameBuf, uint16_t dispWidth, uint16_t dispHeight); |
embeddedartists | 0:7dd43900b657 | 30 | |
embeddedartists | 0:7dd43900b657 | 31 | void run(uint32_t loops, uint32_t delayMs); |
embeddedartists | 0:7dd43900b657 | 32 | |
embeddedartists | 0:7dd43900b657 | 33 | private: |
embeddedartists | 0:7dd43900b657 | 34 | enum Constants { |
embeddedartists | 0:7dd43900b657 | 35 | BACKGROUND_COLOR = BLACK, |
embeddedartists | 0:7dd43900b657 | 36 | LARGE_CIRCLE_COLOR = 0x39e7, //DARK_GRAY |
embeddedartists | 0:7dd43900b657 | 37 | SMALL_CIRCLE_FRONT_COLOR = WHITE, |
embeddedartists | 0:7dd43900b657 | 38 | SMALL_CIRCLE_BACK_COLOR = 0x7bef, //LIGHT_GRAY |
embeddedartists | 0:7dd43900b657 | 39 | }; |
embeddedartists | 0:7dd43900b657 | 40 | |
embeddedartists | 0:7dd43900b657 | 41 | int32_t windowX; |
embeddedartists | 0:7dd43900b657 | 42 | int32_t windowY; |
embeddedartists | 0:7dd43900b657 | 43 | uint16_t *pFrmBuf; |
embeddedartists | 0:7dd43900b657 | 44 | uint16_t *pFrmBuf1; |
embeddedartists | 0:7dd43900b657 | 45 | uint16_t *pFrmBuf2; |
embeddedartists | 0:7dd43900b657 | 46 | uint16_t *pFrmBuf3; |
embeddedartists | 0:7dd43900b657 | 47 | |
embeddedartists | 0:7dd43900b657 | 48 | Graphics graphics; |
embeddedartists | 0:7dd43900b657 | 49 | |
embeddedartists | 0:7dd43900b657 | 50 | unsigned short isqrt(unsigned long a) const; |
embeddedartists | 0:7dd43900b657 | 51 | short _sin(short y) const; |
embeddedartists | 0:7dd43900b657 | 52 | short _cos(short y) const; |
embeddedartists | 0:7dd43900b657 | 53 | short isine(short x) const; |
embeddedartists | 0:7dd43900b657 | 54 | short icosine(short x) const; |
embeddedartists | 0:7dd43900b657 | 55 | void rotate_z(uint32_t angle); |
embeddedartists | 0:7dd43900b657 | 56 | void rotate_y(uint32_t angle); |
embeddedartists | 0:7dd43900b657 | 57 | void initialize(); |
embeddedartists | 0:7dd43900b657 | 58 | void render(uint32_t idx); |
embeddedartists | 0:7dd43900b657 | 59 | |
embeddedartists | 0:7dd43900b657 | 60 | }; |
embeddedartists | 0:7dd43900b657 | 61 | |
embeddedartists | 0:7dd43900b657 | 62 | #endif /* GLOBEDEMO_H */ |
embeddedartists | 0:7dd43900b657 | 63 |