Graphical demo for the LPC4088 Experiment Base Board with one of the Display Expansion Kits. This demo shows a number of dots projected on a rotating sphere.

Dependencies:   EALib mbed

Committer:
embeddedartists
Date:
Fri Oct 03 13:15:25 2014 +0000
Revision:
0:79b286950b60
First version

Who changed what in which revision?

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