Port of the LPC4088 QSB EA LCD Sphere Demo to the LPC4088 DM using the DMSupport lib. Dropping the QSB EALib
Dependencies: DMBasicGUI DMSupport
Fork of lpc4088_displaymodule_hello_world by
Just a quick hack to get something good looking on the LPC4088DM
/media/uploads/tecnosys/lpc4088dm.jpg
SphereDemo.h@5:d2f1c9185c5b, 2015-04-29 (annotated)
- Committer:
- tecnosys
- Date:
- Wed Apr 29 05:34:03 2015 +0000
- Revision:
- 5:d2f1c9185c5b
initial port of EA LCD Demo to DMSupport libs
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tecnosys | 5:d2f1c9185c5b | 1 | |
tecnosys | 5:d2f1c9185c5b | 2 | #ifndef SPHEREDEMO_H |
tecnosys | 5:d2f1c9185c5b | 3 | #define SPHEREDEMO_H |
tecnosys | 5:d2f1c9185c5b | 4 | |
tecnosys | 5:d2f1c9185c5b | 5 | #include "Graphics.h" |
tecnosys | 5:d2f1c9185c5b | 6 | //#include "GFXFb.h" |
tecnosys | 5:d2f1c9185c5b | 7 | |
tecnosys | 5:d2f1c9185c5b | 8 | class SphereDemo { |
tecnosys | 5:d2f1c9185c5b | 9 | public: |
tecnosys | 5:d2f1c9185c5b | 10 | |
tecnosys | 5:d2f1c9185c5b | 11 | /** Set the address of the frame buffer to use. |
tecnosys | 5:d2f1c9185c5b | 12 | * |
tecnosys | 5:d2f1c9185c5b | 13 | * It is the content of the frame buffer that is shown on the |
tecnosys | 5:d2f1c9185c5b | 14 | * display. All the drawing on the frame buffer can be done |
tecnosys | 5:d2f1c9185c5b | 15 | * 'offline' and whenever it should be shown this function |
tecnosys | 5:d2f1c9185c5b | 16 | * can be called with the address of the offline frame buffer. |
tecnosys | 5:d2f1c9185c5b | 17 | * |
tecnosys | 5:d2f1c9185c5b | 18 | * @param pFrameBuf Pointer to the frame buffer, which must be |
tecnosys | 5:d2f1c9185c5b | 19 | * 3 times as big as the frame size (for tripple |
tecnosys | 5:d2f1c9185c5b | 20 | * buffering). |
tecnosys | 5:d2f1c9185c5b | 21 | * dispWidth The width of the display (in pixels). |
tecnosys | 5:d2f1c9185c5b | 22 | * dispHeight The height of the display (in pixels). |
tecnosys | 5:d2f1c9185c5b | 23 | * loops Number of loops in the demo code. |
tecnosys | 5:d2f1c9185c5b | 24 | * delayMs Delay in milliseconds between schreen updates. |
tecnosys | 5:d2f1c9185c5b | 25 | * |
tecnosys | 5:d2f1c9185c5b | 26 | * @returns |
tecnosys | 5:d2f1c9185c5b | 27 | * none |
tecnosys | 5:d2f1c9185c5b | 28 | */ |
tecnosys | 5:d2f1c9185c5b | 29 | SphereDemo(void *pFrameBuf, int dispWidth, int dispHeight); |
tecnosys | 5:d2f1c9185c5b | 30 | |
tecnosys | 5:d2f1c9185c5b | 31 | void run(uint32_t loops, uint32_t delayMs); |
tecnosys | 5:d2f1c9185c5b | 32 | |
tecnosys | 5:d2f1c9185c5b | 33 | private: |
tecnosys | 5:d2f1c9185c5b | 34 | |
tecnosys | 5:d2f1c9185c5b | 35 | enum Constants { |
tecnosys | 5:d2f1c9185c5b | 36 | N = 1024, // Number of dots |
tecnosys | 5:d2f1c9185c5b | 37 | SCALE = 8192, |
tecnosys | 5:d2f1c9185c5b | 38 | INCREMENT = 512, // INCREMENT = SCALE / sqrt(N) * 2 |
tecnosys | 5:d2f1c9185c5b | 39 | SPEED = 5 |
tecnosys | 5:d2f1c9185c5b | 40 | }; |
tecnosys | 5:d2f1c9185c5b | 41 | |
tecnosys | 5:d2f1c9185c5b | 42 | int32_t windowX; |
tecnosys | 5:d2f1c9185c5b | 43 | int32_t windowY; |
tecnosys | 5:d2f1c9185c5b | 44 | uint16_t *pFrmBuf; |
tecnosys | 5:d2f1c9185c5b | 45 | uint16_t *pFrmBuf1; |
tecnosys | 5:d2f1c9185c5b | 46 | uint16_t *pFrmBuf2; |
tecnosys | 5:d2f1c9185c5b | 47 | uint16_t *pFrmBuf3; |
tecnosys | 5:d2f1c9185c5b | 48 | |
tecnosys | 5:d2f1c9185c5b | 49 | Graphics graphics; |
tecnosys | 5:d2f1c9185c5b | 50 | //Display* _disp; |
tecnosys | 5:d2f1c9185c5b | 51 | |
tecnosys | 5:d2f1c9185c5b | 52 | |
tecnosys | 5:d2f1c9185c5b | 53 | int16_t sine[SCALE]; |
tecnosys | 5:d2f1c9185c5b | 54 | int16_t cosi[SCALE]; |
tecnosys | 5:d2f1c9185c5b | 55 | |
tecnosys | 5:d2f1c9185c5b | 56 | uint16_t fastsqrt(uint32_t n) const; |
tecnosys | 5:d2f1c9185c5b | 57 | void matrix(int16_t xyz[3][N], uint8_t rgb[3][N]); |
tecnosys | 5:d2f1c9185c5b | 58 | void rotate(int16_t xyz[3][N], uint8_t rgb[3][N], uint16_t angleX, uint16_t angleY, uint16_t angleZ); |
tecnosys | 5:d2f1c9185c5b | 59 | void draw(int16_t xyz[3][N], uint8_t rgb[3][N]); |
tecnosys | 5:d2f1c9185c5b | 60 | }; |
tecnosys | 5:d2f1c9185c5b | 61 | |
tecnosys | 5:d2f1c9185c5b | 62 | #endif /* SPHEREDEMO_H */ |
tecnosys | 5:d2f1c9185c5b | 63 |