From e6f17baf6133fb83c5c72f7b173cf50c9c275224 Mon Sep 17 00:00:00 2001 From: inmarket Date: Thu, 24 Oct 2013 15:03:47 +1000 Subject: GMISC invsqrt() function. Fix a 64bit processor bug. Add support for processors where the floating point and integer endianness don't match. Add support for processors with a non-standard floating point format. Update gdisp_streaming demo with extra comments to reflect the above changes. --- demos/modules/gdisp/gdisp_streaming/gfxconf.h | 10 +++++---- demos/modules/gdisp/gdisp_streaming/main.c | 32 +++++++++++++++++++-------- 2 files changed, 29 insertions(+), 13 deletions(-) (limited to 'demos') diff --git a/demos/modules/gdisp/gdisp_streaming/gfxconf.h b/demos/modules/gdisp/gdisp_streaming/gfxconf.h index 4db07fb9..b38be854 100644 --- a/demos/modules/gdisp/gdisp_streaming/gfxconf.h +++ b/demos/modules/gdisp/gdisp_streaming/gfxconf.h @@ -35,9 +35,11 @@ /* Builtin Fonts */ #define GDISP_INCLUDE_FONT_UI2 FALSE -#define GFX_USE_GMISC TRUE -#define GMISC_NEED_FIXEDTRIG FALSE -#define GMISC_NEED_FASTTRIG FALSE -#define GMISC_NEED_INVSQRT TRUE +#define GFX_USE_GMISC TRUE +#define GMISC_NEED_FIXEDTRIG FALSE +#define GMISC_NEED_FASTTRIG FALSE +#define GMISC_NEED_INVSQRT TRUE +//#define GDISP_INVSQRT_MIXED_ENDIAN TRUE +//#define GDISP_INVSQRT_REAL_SLOW TRUE #endif /* _GFXCONF_H */ diff --git a/demos/modules/gdisp/gdisp_streaming/main.c b/demos/modules/gdisp/gdisp_streaming/main.c index 774ee833..5b857eeb 100644 --- a/demos/modules/gdisp/gdisp_streaming/main.c +++ b/demos/modules/gdisp/gdisp_streaming/main.c @@ -31,15 +31,29 @@ #include "gfx.h" #include -#define Lightgrey () -#define Midgrey () -#define Darkgrey (HTML2COLOR(0x303030)) - -#define BALLCOLOR1 Red -#define BALLCOLOR2 Yellow -#define WALLCOLOR HTML2COLOR(0x303030) -#define BACKCOLOR HTML2COLOR(0xC0C0C0) -#define FLOORCOLOR HTML2COLOR(0x606060) +/** + * NOTE: + * + * This demo uses floating point operations. Don't expect it to work with any + * speed unless your processor has an FPU. + * + * If you see garbage inside the ball as it is running rather than the red and yellow + * checkerboard pattern then the fast invsqrt() function in GMISC does not work on + * your processor. + * + * You can modify the implementation of invsqrt() by firstly defining + * #define GDISP_INVSQRT_MIXED_ENDIAN TRUE + * in your gfxconf.h file. + * + * If it still doesn't work then instead define + * #define GDISP_INVSQRT_REAL_SLOW TRUE + * in your gfxconf.h file. This should always work although it will probably be slow. + */ +#define BALLCOLOR1 Red +#define BALLCOLOR2 Yellow +#define WALLCOLOR HTML2COLOR(0x303030) +#define BACKCOLOR HTML2COLOR(0xC0C0C0) +#define FLOORCOLOR HTML2COLOR(0x606060) #define SHADOWALPHA (255-255*0.2) int main(void) { -- cgit v1.2.3