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 Embedded Artists

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SphereDemo.h Source File

SphereDemo.h

00001 
00002 #ifndef SPHEREDEMO_H
00003 #define SPHEREDEMO_H
00004 
00005 #include "Graphics.h"
00006 //#include "GFXFb.h"
00007 
00008 class SphereDemo {
00009 public:
00010 
00011     /** Set the address of the frame buffer to use.
00012      *
00013      *  It is the content of the frame buffer that is shown on the
00014      *  display. All the drawing on the frame buffer can be done
00015      *  'offline' and whenever it should be shown this function
00016      *  can be called with the address of the offline frame buffer.
00017      *
00018      *  @param pFrameBuf  Pointer to the frame buffer, which must be
00019      *                    3 times as big as the frame size (for tripple
00020      *                    buffering).
00021      *         dispWidth  The width of the display (in pixels).
00022      *         dispHeight The height of the display (in pixels).
00023      *         loops      Number of loops in the demo code.
00024      *         delayMs    Delay in milliseconds between schreen updates.
00025      *
00026      *  @returns
00027      *       none
00028      */
00029     SphereDemo(void *pFrameBuf, int dispWidth, int dispHeight);
00030     
00031     void run(uint32_t loops, uint32_t delayMs);
00032 
00033 private:
00034 
00035     enum Constants {
00036         N         = 1024, // Number of dots
00037         SCALE     = 8192,
00038         INCREMENT = 512,  // INCREMENT = SCALE / sqrt(N) * 2
00039         SPEED     = 5
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     //Display* _disp;
00051 
00052     
00053     int16_t sine[SCALE];
00054     int16_t cosi[SCALE];
00055     
00056     uint16_t fastsqrt(uint32_t n) const;
00057     void matrix(int16_t xyz[3][N], uint8_t rgb[3][N]);
00058     void rotate(int16_t xyz[3][N], uint8_t rgb[3][N], uint16_t angleX, uint16_t angleY, uint16_t angleZ);
00059     void draw(int16_t xyz[3][N], uint8_t rgb[3][N]);
00060 };
00061 
00062 #endif /* SPHEREDEMO_H */
00063