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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GlobeDemo.h Source File

GlobeDemo.h

00001 
00002 #ifndef GLOBEDEMO_H
00003 #define GLOBEDEMO_H
00004 
00005 #include "Graphics.h"
00006 #include "GFXFb.h"
00007 #include "EaLcdBoardGPIO.h"
00008 
00009 class GlobeDemo {
00010 public:
00011 
00012     /** Set the address of the frame buffer to use.
00013      *
00014      *  It is the content of the frame buffer that is shown on the
00015      *  display. All the drawing on the frame buffer can be done
00016      *  'offline' and whenever it should be shown this function
00017      *  can be called with the address of the offline frame buffer.
00018      *
00019      *  @param pFrameBuf  Pointer to the frame buffer, which must be
00020      *                    3 times as big as the frame size (for tripple
00021      *                    buffering).
00022      *         dispWidth  The width of the display (in pixels).
00023      *         dispHeight The height of the display (in pixels).
00024      *         loops      Number of loops in the demo code.
00025      *         delayMs    Delay in milliseconds between schreen updates.
00026      *
00027      *  @returns
00028      *       none
00029      */
00030     GlobeDemo(uint8_t *pFrameBuf, uint16_t dispWidth, uint16_t dispHeight);
00031     
00032     void run(EaLcdBoardGPIO& lcdBoard, uint32_t loops, uint32_t delayMs);
00033 
00034 private:
00035     enum Constants {
00036         BACKGROUND_COLOR         = BLACK,
00037         LARGE_CIRCLE_COLOR       = 0x39e7, //DARK_GRAY
00038         SMALL_CIRCLE_FRONT_COLOR = WHITE,
00039         SMALL_CIRCLE_BACK_COLOR  = 0x7bef, //LIGHT_GRAY
00040     };
00041 
00042     int32_t windowX;
00043     int32_t windowY;
00044     uint16_t *pFrmBuf;
00045     uint16_t *pFrmBuf1;
00046     uint16_t *pFrmBuf2;
00047     uint16_t *pFrmBuf3;
00048     
00049     Graphics graphics;
00050     
00051     unsigned short isqrt(unsigned long a) const;
00052     short _sin(short y) const;
00053     short _cos(short y) const;
00054     short isine(short x) const;
00055     short icosine(short x) const;
00056     void rotate_z(uint32_t angle);
00057     void rotate_y(uint32_t angle);
00058     void initialize();
00059     void render(uint32_t idx);
00060 
00061 };
00062 
00063 #endif /* GLOBEDEMO_H */
00064