From db09e33dff7110861ce2fa586b04c05626e3f7e8 Mon Sep 17 00:00:00 2001 From: inmarket Date: Mon, 28 Oct 2013 10:46:25 +1000 Subject: Fix spelling error and migrate demo gfxconf.h changes to all demos including the new streaming and multiple display demos --- demos/3rdparty/bubbles/gfxconf.h | 9 +- demos/3rdparty/notepad-2/gfxconf.h | 9 +- demos/3rdparty/tdisp_f4_discovery/gfxconf.h | 6 + demos/applications/mandelbrot/gfxconf.h | 20 +-- demos/applications/notepad/gfxconf.h | 14 +- demos/benchmarks/gfxconf.h | 21 +-- demos/modules/gadc/gfxconf.h | 77 +---------- demos/modules/gaudin/gfxconf.h | 84 +----------- demos/modules/gdisp/basics/gfxconf.h | 6 +- demos/modules/gdisp/circles/gfxconf.h | 6 +- demos/modules/gdisp/fonts/gfxconf.h | 22 +--- demos/modules/gdisp/fonts_cyrillic/gfxconf.h | 10 +- .../gdisp/gdisp_multiple_displays/gfxconf.h | 88 ------------- demos/modules/gdisp/gdisp_multiple_displays/main.c | 122 ------------------ demos/modules/gdisp/gdisp_streaming/gfxconf.h | 45 ------- demos/modules/gdisp/gdisp_streaming/main.c | 142 --------------------- demos/modules/gdisp/images/gfxconf.h | 6 +- demos/modules/gdisp/images_animated/gfxconf.h | 6 +- demos/modules/gdisp/multiple_displays/gfxconf.h | 80 ++++++++++++ demos/modules/gdisp/multiple_displays/main.c | 122 ++++++++++++++++++ demos/modules/gdisp/streaming/gfxconf.h | 31 +++++ demos/modules/gdisp/streaming/main.c | 142 +++++++++++++++++++++ demos/modules/ginput/touch_driver_test/gfxconf.h | 21 +-- demos/modules/gtimer/gfxconf.h | 9 +- demos/modules/gwin/basic/gfxconf.h | 6 +- demos/modules/gwin/button/gfxconf.h | 6 +- demos/modules/gwin/checkbox/gfxconf.h | 6 +- demos/modules/gwin/console/gfxconf.h | 6 +- demos/modules/gwin/graph/gfxconf.h | 6 +- demos/modules/gwin/list/gfxconf.h | 6 +- demos/modules/gwin/radio/gfxconf.h | 6 +- demos/modules/gwin/slider/gfxconf.h | 6 +- demos/modules/gwin/widgets/gfxconf.h | 6 +- demos/modules/tdisp/gfxconf.h | 9 +- 34 files changed, 481 insertions(+), 680 deletions(-) delete mode 100644 demos/modules/gdisp/gdisp_multiple_displays/gfxconf.h delete mode 100644 demos/modules/gdisp/gdisp_multiple_displays/main.c delete mode 100644 demos/modules/gdisp/gdisp_streaming/gfxconf.h delete mode 100644 demos/modules/gdisp/gdisp_streaming/main.c create mode 100644 demos/modules/gdisp/multiple_displays/gfxconf.h create mode 100644 demos/modules/gdisp/multiple_displays/main.c create mode 100644 demos/modules/gdisp/streaming/gfxconf.h create mode 100644 demos/modules/gdisp/streaming/main.c (limited to 'demos') diff --git a/demos/3rdparty/bubbles/gfxconf.h b/demos/3rdparty/bubbles/gfxconf.h index 344a986e..1ecfc544 100644 --- a/demos/3rdparty/bubbles/gfxconf.h +++ b/demos/3rdparty/bubbles/gfxconf.h @@ -9,10 +9,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use - one of these must be defined */ -#define GFX_USE_OS_CHIBIOS TRUE -#define GFX_USE_OS_WIN32 FALSE -#define GFX_USE_OS_POSIX FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/3rdparty/notepad-2/gfxconf.h b/demos/3rdparty/notepad-2/gfxconf.h index 7f436596..869b2ab2 100644 --- a/demos/3rdparty/notepad-2/gfxconf.h +++ b/demos/3rdparty/notepad-2/gfxconf.h @@ -9,10 +9,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* GFX operating system to use */ -#define GFX_USE_OS_CHIBIOS TRUE -//#define GFX_USE_OS_WIN32 TRUE -//#define GFX_USE_OS_POSIX TRUE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/3rdparty/tdisp_f4_discovery/gfxconf.h b/demos/3rdparty/tdisp_f4_discovery/gfxconf.h index 6d69b3c8..42399ef5 100644 --- a/demos/3rdparty/tdisp_f4_discovery/gfxconf.h +++ b/demos/3rdparty/tdisp_f4_discovery/gfxconf.h @@ -14,6 +14,12 @@ #ifndef _GFXCONF_H #define _GFXCONF_H +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE + /* GFX subsystems to turn on */ #define GFX_USE_GDISP FALSE #define GFX_USE_TDISP TRUE diff --git a/demos/applications/mandelbrot/gfxconf.h b/demos/applications/mandelbrot/gfxconf.h index c2c56714..99a04b5c 100644 --- a/demos/applications/mandelbrot/gfxconf.h +++ b/demos/applications/mandelbrot/gfxconf.h @@ -30,26 +30,16 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use - one of these must be defined */ -#define GFX_USE_OS_CHIBIOS TRUE -#define GFX_USE_OS_WIN32 FALSE -#define GFX_USE_OS_POSIX FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE /* Features for the GDISP sub-system. */ #define GDISP_NEED_VALIDATION TRUE -#define GDISP_NEED_CLIP FALSE -#define GDISP_NEED_TEXT FALSE -#define GDISP_NEED_CIRCLE FALSE -#define GDISP_NEED_ELLIPSE FALSE -#define GDISP_NEED_ARC FALSE -#define GDISP_NEED_SCROLL FALSE -#define GDISP_NEED_PIXELREAD FALSE -#define GDISP_NEED_CONTROL FALSE -#define GDISP_NEED_MULTITHREAD FALSE -#define GDISP_NEED_ASYNC FALSE -#define GDISP_NEED_MSGAPI FALSE #endif /* _GFXCONF_H */ diff --git a/demos/applications/notepad/gfxconf.h b/demos/applications/notepad/gfxconf.h index 95d5dc5e..7ffb22fa 100644 --- a/demos/applications/notepad/gfxconf.h +++ b/demos/applications/notepad/gfxconf.h @@ -30,14 +30,14 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use - one of these must be defined */ -//#define GFX_USE_OS_CHIBIOS TRUE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE -//#define GFX_USE_OS_POSIX FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE -#define GFX_USE_GWIN FALSE #define GFX_USE_GEVENT TRUE #define GFX_USE_GTIMER TRUE #define GFX_USE_GINPUT TRUE @@ -47,14 +47,8 @@ #define GDISP_NEED_CLIP TRUE #define GDISP_NEED_TEXT TRUE #define GDISP_NEED_CIRCLE TRUE -#define GDISP_NEED_ELLIPSE FALSE -#define GDISP_NEED_ARC FALSE -#define GDISP_NEED_SCROLL FALSE -#define GDISP_NEED_PIXELREAD FALSE #define GDISP_NEED_CONTROL TRUE #define GDISP_NEED_MULTITHREAD TRUE -#define GDISP_NEED_ASYNC FALSE -#define GDISP_NEED_MSGAPI FALSE /* Builtin Fonts */ #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA TRUE diff --git a/demos/benchmarks/gfxconf.h b/demos/benchmarks/gfxconf.h index 36a6c5b9..aaacd3a2 100644 --- a/demos/benchmarks/gfxconf.h +++ b/demos/benchmarks/gfxconf.h @@ -30,10 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use - one of these must be defined */ -#define GFX_USE_OS_CHIBIOS TRUE -#define GFX_USE_OS_WIN32 FALSE -#define GFX_USE_OS_POSIX FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE @@ -42,22 +43,10 @@ #define GDISP_NEED_VALIDATION FALSE #define GDISP_NEED_CLIP FALSE #define GDISP_NEED_TEXT TRUE -#define GDISP_NEED_CIRCLE FALSE -#define GDISP_NEED_ELLIPSE FALSE -#define GDISP_NEED_ARC FALSE -#define GDISP_NEED_SCROLL FALSE -#define GDISP_NEED_PIXELREAD FALSE #define GDISP_NEED_CONTROL TRUE -#define GDISP_NEED_MULTITHREAD FALSE -#define GDISP_NEED_ASYNC FALSE -#define GDISP_NEED_MSGAPI FALSE /* Builtin Fonts */ -#define GDISP_INCLUDE_FONT_SMALL FALSE -#define GDISP_INCLUDE_FONT_LARGER FALSE -#define GDISP_INCLUDE_FONT_UI1 FALSE #define GDISP_INCLUDE_FONT_UI2 TRUE -#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE #endif /* _GFXCONF_H */ diff --git a/demos/modules/gadc/gfxconf.h b/demos/modules/gadc/gfxconf.h index ff306763..297265b5 100644 --- a/demos/modules/gadc/gfxconf.h +++ b/demos/modules/gadc/gfxconf.h @@ -35,96 +35,29 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use - one of these must be defined */ -#define GFX_USE_OS_CHIBIOS TRUE -#define GFX_USE_OS_WIN32 FALSE -#define GFX_USE_OS_POSIX FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE -#define GFX_USE_TDISP FALSE #define GFX_USE_GWIN TRUE -#define GFX_USE_GEVENT FALSE #define GFX_USE_GTIMER TRUE -#define GFX_USE_GINPUT FALSE #define GFX_USE_GADC TRUE -#define GFX_USE_GAUDIN FALSE -#define GFX_USE_GAUDOUT FALSE -#define GFX_USE_GMISC FALSE /* Features for the GDISP sub-system. */ #define GDISP_NEED_VALIDATION TRUE #define GDISP_NEED_CLIP TRUE #define GDISP_NEED_TEXT TRUE -#define GDISP_NEED_CIRCLE FALSE -#define GDISP_NEED_ELLIPSE FALSE -#define GDISP_NEED_ARC FALSE -#define GDISP_NEED_SCROLL FALSE -#define GDISP_NEED_PIXELREAD FALSE #define GDISP_NEED_CONTROL TRUE #define GDISP_NEED_MULTITHREAD TRUE -#define GDISP_NEED_ASYNC FALSE -#define GDISP_NEED_MSGAPI FALSE /* GDISP - builtin fonts */ -#define GDISP_INCLUDE_FONT_SMALL FALSE -#define GDISP_INCLUDE_FONT_LARGER FALSE -#define GDISP_INCLUDE_FONT_UI1 FALSE #define GDISP_INCLUDE_FONT_UI2 TRUE -#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE - -/* Features for the TDISP subsystem. */ -#define TDISP_NEED_MULTITHREAD FALSE /* Features for the GWIN sub-system. */ -#define GWIN_NEED_BUTTON FALSE #define GWIN_NEED_CONSOLE TRUE -#define GWIN_NEED_GRAPH FALSE - -/* Features for the GEVENT sub-system. */ -#define GEVENT_ASSERT_NO_RESOURCE FALSE - -/* Features for the GTIMER sub-system. */ -/* NONE */ - -/* Features for the GINPUT sub-system. */ -#define GINPUT_NEED_MOUSE FALSE -#define GINPUT_NEED_KEYBOARD FALSE -#define GINPUT_NEED_TOGGLE FALSE -#define GINPUT_NEED_DIAL FALSE - -/* Features for the GADC sub-system. */ -/* NONE */ - -/* Features for the GAUDIN sub-system. */ -/* NONE */ - -/* Features for the GAUDOUT sub-system. */ -/* NONE */ - -/* Features for the GMISC sub-system. */ -#define GMISC_NEED_ARRAYOPS FALSE - -/* Optional Parameters for various sub-systems */ -/* - #define GDISP_MAX_FONT_HEIGHT 16 - #define GEVENT_MAXIMUM_SIZE 32 - #define GEVENT_MAX_SOURCE_LISTENERS 32 - #define GTIMER_THREAD_WORKAREA_SIZE 512 - #define GADC_MAX_LOWSPEED_DEVICES 4 -*/ - -/* Optional Low Level Driver Definitions */ -/* - #define GDISP_USE_CUSTOM_BOARD FALSE - #define GDISP_SCREEN_WIDTH 320 - #define GDISP_SCREEN_HEIGHT 240 - #define GDISP_USE_FSMC - #define GDISP_USE_GPIO - #define GDISP_VMT_NAME1(x) x##YourDriver1 - #define GDISP_VMT_NAME2(x) x##YourDriver2 - #define TDISP_COLUMNS 16 - #define TDISP_ROWS 2 -*/ #endif /* _GFXCONF_H */ diff --git a/demos/modules/gaudin/gfxconf.h b/demos/modules/gaudin/gfxconf.h index a17e4fd9..9525a020 100644 --- a/demos/modules/gaudin/gfxconf.h +++ b/demos/modules/gaudin/gfxconf.h @@ -35,96 +35,22 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use - one of these must be defined */ -#define GFX_USE_OS_CHIBIOS TRUE -#define GFX_USE_OS_WIN32 FALSE -#define GFX_USE_OS_POSIX FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE -#define GFX_USE_TDISP FALSE #define GFX_USE_GWIN TRUE -#define GFX_USE_GEVENT FALSE #define GFX_USE_GTIMER TRUE -#define GFX_USE_GINPUT FALSE #define GFX_USE_GADC TRUE #define GFX_USE_GAUDIN TRUE -#define GFX_USE_GAUDOUT FALSE -#define GFX_USE_GMISC FALSE /* Features for the GDISP sub-system. */ #define GDISP_NEED_VALIDATION TRUE #define GDISP_NEED_CLIP TRUE -#define GDISP_NEED_TEXT FALSE -#define GDISP_NEED_CIRCLE FALSE -#define GDISP_NEED_ELLIPSE FALSE -#define GDISP_NEED_ARC FALSE -#define GDISP_NEED_SCROLL FALSE -#define GDISP_NEED_PIXELREAD FALSE -#define GDISP_NEED_CONTROL FALSE #define GDISP_NEED_MULTITHREAD TRUE -#define GDISP_NEED_ASYNC FALSE -#define GDISP_NEED_MSGAPI FALSE - -/* GDISP - builtin fonts */ -#define GDISP_INCLUDE_FONT_SMALL FALSE -#define GDISP_INCLUDE_FONT_LARGER FALSE -#define GDISP_INCLUDE_FONT_UI1 FALSE -#define GDISP_INCLUDE_FONT_UI2 FALSE -#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE - -/* Features for the TDISP subsystem. */ -#define TDISP_NEED_MULTITHREAD FALSE - -/* Features for the GWIN sub-system. */ -#define GWIN_NEED_BUTTON FALSE -#define GWIN_NEED_CONSOLE FALSE -#define GWIN_NEED_GRAPH FALSE - -/* Features for the GEVENT sub-system. */ -#define GEVENT_ASSERT_NO_RESOURCE FALSE - -/* Features for the GTIMER sub-system. */ -/* NONE */ - -/* Features for the GINPUT sub-system. */ -#define GINPUT_NEED_MOUSE FALSE -#define GINPUT_NEED_KEYBOARD FALSE -#define GINPUT_NEED_TOGGLE FALSE -#define GINPUT_NEED_DIAL FALSE - -/* Features for the GADC sub-system. */ -/* NONE */ - -/* Features for the GAUDIN sub-system. */ -/* NONE */ - -/* Features for the GAUDOUT sub-system. */ -/* NONE */ - -/* Features for the GMISC sub-system. */ -#define GMISC_NEED_ARRAYOPS FALSE - -/* Optional Parameters for various sub-systems */ -/* - #define GDISP_MAX_FONT_HEIGHT 16 - #define GEVENT_MAXIMUM_SIZE 32 - #define GEVENT_MAX_SOURCE_LISTENERS 32 - #define GTIMER_THREAD_WORKAREA_SIZE 512 - #define GADC_MAX_LOWSPEED_DEVICES 4 -*/ - -/* Optional Low Level Driver Definitions */ -/* - #define GDISP_USE_CUSTOM_BOARD FALSE - #define GDISP_SCREEN_WIDTH 320 - #define GDISP_SCREEN_HEIGHT 240 - #define GDISP_USE_FSMC - #define GDISP_USE_GPIO - #define GDISP_VMT_NAME1(x) x##YourDriver1 - #define GDISP_VMT_NAME2(x) x##YourDriver2 - #define TDISP_COLUMNS 16 - #define TDISP_ROWS 2 -*/ #endif /* _GFXCONF_H */ diff --git a/demos/modules/gdisp/basics/gfxconf.h b/demos/modules/gdisp/basics/gfxconf.h index 60b8888e..a37ef1e7 100644 --- a/demos/modules/gdisp/basics/gfxconf.h +++ b/demos/modules/gdisp/basics/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gdisp/circles/gfxconf.h b/demos/modules/gdisp/circles/gfxconf.h index 28311ccb..4bb605ac 100644 --- a/demos/modules/gdisp/circles/gfxconf.h +++ b/demos/modules/gdisp/circles/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gdisp/fonts/gfxconf.h b/demos/modules/gdisp/fonts/gfxconf.h index 9f569e37..64481774 100644 --- a/demos/modules/gdisp/fonts/gfxconf.h +++ b/demos/modules/gdisp/fonts/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE @@ -43,18 +43,13 @@ #define GDISP_NEED_VALIDATION TRUE #define GDISP_NEED_CLIP TRUE #define GDISP_NEED_TEXT TRUE -#define GDISP_NEED_CIRCLE FALSE -#define GDISP_NEED_ELLIPSE FALSE -#define GDISP_NEED_ARC FALSE -#define GDISP_NEED_SCROLL FALSE -#define GDISP_NEED_PIXELREAD FALSE -#define GDISP_NEED_CONTROL FALSE -#define GDISP_NEED_MULTITHREAD FALSE -#define GDISP_NEED_ASYNC FALSE -#define GDISP_NEED_MSGAPI FALSE #define GDISP_NEED_ANTIALIAS TRUE /* GDISP - fonts to include */ +#define GDISP_INCLUDE_USER_FONTS TRUE +#define GDISP_INCLUDE_FONT_UI1 FALSE +#define GDISP_INCLUDE_FONT_UI2 TRUE +#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS10 TRUE #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE @@ -70,9 +65,6 @@ #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE -#define GDISP_INCLUDE_FONT_UI1 FALSE -#define GDISP_INCLUDE_FONT_UI2 TRUE -#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE #endif /* _GFXCONF_H */ diff --git a/demos/modules/gdisp/fonts_cyrillic/gfxconf.h b/demos/modules/gdisp/fonts_cyrillic/gfxconf.h index 1bf1baeb..dab77ba1 100644 --- a/demos/modules/gdisp/fonts_cyrillic/gfxconf.h +++ b/demos/modules/gdisp/fonts_cyrillic/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE -//#define GFX_USE_OS_WIN32 FALSE -//#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX subsystems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gdisp/gdisp_multiple_displays/gfxconf.h b/demos/modules/gdisp/gdisp_multiple_displays/gfxconf.h deleted file mode 100644 index 71c16864..00000000 --- a/demos/modules/gdisp/gdisp_multiple_displays/gfxconf.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu - * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _GFXCONF_H -#define _GFXCONF_H - -/* The operating system to use - one of these must be defined */ -//#define GFX_USE_OS_CHIBIOS TRUE -//#define GFX_USE_OS_WIN32 FALSE -//#define GFX_USE_OS_POSIX FALSE - -/* GFX sub-systems to turn on */ -#define GFX_USE_GDISP TRUE - -/* Features for the GDISP sub-system. */ -#define GDISP_NEED_VALIDATION TRUE -#define GDISP_NEED_CLIP TRUE -#define GDISP_NEED_TEXT TRUE -#define GDISP_NEED_CIRCLE FALSE -#define GDISP_NEED_ELLIPSE FALSE -#define GDISP_NEED_ARC FALSE -#define GDISP_NEED_SCROLL FALSE -#define GDISP_NEED_PIXELREAD FALSE -#define GDISP_NEED_CONTROL FALSE -#define GDISP_NEED_MULTITHREAD FALSE -#define GDISP_NEED_ASYNC FALSE -#define GDISP_NEED_MSGAPI FALSE - -#define GDISP_INCLUDE_FONT_UI2 TRUE - -#define GDISP_TOTAL_DISPLAYS 2 - -/* Uncomment the following lines if you want to use multiple displays on - * different controllers. - * - * Change the definitions to suit your hardware. - * Currently all controllers must use the same pixel format. - * - * Remember that GDISP_TOTAL_DISPLAYS above must match the **Total** - * number of displays in your system across all controllers. - * - * Optionally, you can also specify hardware characteristics that are common to - * all your controllers. This significantly improves code and speed efficiency - * as the program doesn't have to detect the hardware method to use on each call. - * - * Hardware definitions can be set to: - * - TRUE - all controllers support this routine - * - FALSE - no controllers support this routine - * - if not specified then the code auto-detects the hardware. - * - * e.g - * #define GDISP_HARDWARE_STREAM_WRITE FALSE - * #define GDISP_HARDWARE_STREAM_READ FALSE - * #define GDISP_HARDWARE_DRAWPIXEL TRUE - * #define GDISP_HARDWARE_FILLS TRUE - */ -//#define GDISP_TOTAL_CONTROLLERS 2 -//#define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_Win32 -//#define GDISP_CONTROLLER_DISPLAYS 1, 1 -//#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888 - -#endif /* _GFXCONF_H */ diff --git a/demos/modules/gdisp/gdisp_multiple_displays/main.c b/demos/modules/gdisp/gdisp_multiple_displays/main.c deleted file mode 100644 index 443bee27..00000000 --- a/demos/modules/gdisp/gdisp_multiple_displays/main.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu - * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "gfx.h" - -#include - -/* - * This demo demonstrates two ways to talk to multiple displays. - * - * Method 1 is the preferred way however Method 1 would be useful - * when quickly converting existing single display applications. - * - * Note you can combine the methods using method 2 for the first display - * and method 1 for any extra displays. - */ - -#define USE_METHOD_1 FALSE - -#if USE_METHOD_1 - int main(void) { - coord_t width, height; - coord_t display, i, j; - font_t f; - GDisplay *g; - char buf[16]; - - /* Initialize and clear the display */ - gfxInit(); - - /* Get a font to write with */ - f = gdispOpenFont("*"); - - /* Cycle through each display */ - for(display = 0; display < GDISP_TOTAL_DISPLAYS; display++) { - - // Get the specified display - g = gdispGetDisplay(display); - - // Get the screen size - width = gdispGGetWidth(g); - height = gdispGGetHeight(g); - - /* Draw draw draw */ - gdispGDrawBox(g, 10, 10, width/2, height/2, Yellow); - sprintf(buf, "Display %u", display); - gdispGFillStringBox(g, width/2, height/2, width/2-10, height/2-10, buf, f, White, Blue, justifyCenter); - gdispGDrawLine(g, 5, 30, width-50, height-40, Red); - - for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20) - gdispGDrawPixel(g, i, j, White); - } - - while(TRUE) { - gfxSleepMilliseconds(500); - } - } -#else - int main(void) { - coord_t width, height; - coord_t display, i, j; - font_t f; - char buf[16]; - - /* Initialize and clear the display */ - gfxInit(); - - /* Get a font to write with */ - f = gdispOpenFont("*"); - - /* Cycle through each display */ - for(display = 0; display < GDISP_TOTAL_DISPLAYS; display++) { - - // Set the default display to the specified display - gdispSetDisplay(gdispGetDisplay(display)); - - // Get the screen size - width = gdispGetWidth(); - height = gdispGetHeight(); - - /* Draw draw draw */ - gdispDrawBox(10, 10, width/2, height/2, Yellow); - sprintf(buf, "Display %u", display); - gdispFillStringBox(width/2, height/2, width/2-10, height/2-10, buf, f, White, Blue, justifyCenter); - gdispDrawLine(5, 30, width-50, height-40, Red); - - for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20) - gdispDrawPixel(i, j, White); - } - - while(TRUE) { - gfxSleepMilliseconds(500); - } - } -#endif - diff --git a/demos/modules/gdisp/gdisp_streaming/gfxconf.h b/demos/modules/gdisp/gdisp_streaming/gfxconf.h deleted file mode 100644 index b38be854..00000000 --- a/demos/modules/gdisp/gdisp_streaming/gfxconf.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * This file has a different license to the rest of the GFX system. - * You can copy, modify and distribute this file as you see fit. - * You do not need to publish your source modifications to this file. - * The only thing you are not permitted to do is to relicense it - * under a different license. - */ - -#ifndef _GFXCONF_H -#define _GFXCONF_H - -/* The operating system to use - one of these must be defined */ -//#define GFX_USE_OS_CHIBIOS TRUE -//#define GFX_USE_OS_WIN32 FALSE -//#define GFX_USE_OS_POSIX FALSE - -/* GFX sub-systems to turn on */ -#define GFX_USE_GDISP TRUE -#define GFX_USE_GMISC TRUE - -/* Features for the GDISP sub-system. */ -#define GDISP_NEED_AUTOFLUSH FALSE -#define GDISP_NEED_VALIDATION TRUE -#define GDISP_NEED_CLIP FALSE -#define GDISP_NEED_TEXT FALSE -#define GDISP_NEED_CIRCLE FALSE -#define GDISP_NEED_ELLIPSE FALSE -#define GDISP_NEED_ARC FALSE -#define GDISP_NEED_SCROLL FALSE -#define GDISP_NEED_PIXELREAD FALSE -#define GDISP_NEED_CONTROL FALSE -#define GDISP_NEED_MULTITHREAD FALSE -#define GDISP_NEED_STREAMING TRUE - -/* 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 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 deleted file mode 100644 index 5b857eeb..00000000 --- a/demos/modules/gdisp/gdisp_streaming/main.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu - * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket - * Derived from the 2011 IOCCC submission by peter.eastman@gmail.com - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "gfx.h" -#include - -/** - * 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) { - coord_t width, height, x, y, radius, ballx, bally, dx, floor; - coord_t minx, miny, maxx, maxy; - coord_t ballcx, ballcy; - color_t colour; - float ii, spin, dy, spinspeed, h, f, g; - - gfxInit(); - #if GDISP_NEED_CONTROL - gdispSetOrientation(GDISP_ROTATE_90); - #endif - - width = gdispGetWidth(); - height = gdispGetHeight(); - - radius=height/5+height%2+1; // The ball radius - ii = 1.0/radius; // radius as easy math - floor=height/5-1; // floor position - spin=0.0; // current spin angle on the ball - spinspeed=0.1; // current spin speed of the ball - ballx=width/2; // ball x position (relative to the ball center) - bally=height/4; // ball y position (relative to the ball center) - dx=.01*width; // motion in the x axis - dy=0.0; // motion in the y axis - ballcx = 12*radius/5; // ball x diameter including the shadow - ballcy = 21*radius/10; // ball y diameter including the shadow - - - minx = miny = 0; maxx = width; maxy = height; // The clipping window for this frame. - - while(1) { - // Draw one frame - gdispStreamStart(minx, miny, maxx-minx, maxy-miny); - for (y=miny; h = (bally-y)*ii, y height-floor) { - if (x < height-y || height-y > width-x) - colour = WALLCOLOR; - else - colour = FLOORCOLOR; - } else if (xwidth-floor) - colour = WALLCOLOR; - else - colour = BACKCOLOR; - - // The ball shadow is darker - if (g*(g+.4)+h*(h+.1) < 1) - colour = gdispBlendColor(colour, Black, SHADOWALPHA); - } - gdispStreamColor(colour); /* pixel to the LCD */ - } - } - gdispStreamStop(); - - // Force a display update if the controller supports it - gdispFlush(); - - // Calculate the new frame size (note this is a drawing optimisation only) - minx = ballx - radius; miny = bally - radius; - maxx = minx + ballcx; maxy = miny + ballcy; - if (dx > 0) maxx += dx; else minx += dx; - if (dy > 0) maxy += dy; else miny += dy; - if (minx < 0) minx = 0; - if (maxx > width) maxx = width; - if (miny < 0) miny = 0; - if (maxy > height) maxy = height; - - // Motion - spin += spinspeed; - ballx += dx; bally += dy; - dx = ballx < radius || ballx > width-radius ? spinspeed=-spinspeed,-dx : dx; - dy = bally > height-1.75*floor ? -.04*height : dy+.002*height; - } -} diff --git a/demos/modules/gdisp/images/gfxconf.h b/demos/modules/gdisp/images/gfxconf.h index 0bf9f1fc..6cd78b37 100644 --- a/demos/modules/gdisp/images/gfxconf.h +++ b/demos/modules/gdisp/images/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gdisp/images_animated/gfxconf.h b/demos/modules/gdisp/images_animated/gfxconf.h index 8cf34e87..cc38ed36 100644 --- a/demos/modules/gdisp/images_animated/gfxconf.h +++ b/demos/modules/gdisp/images_animated/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gdisp/multiple_displays/gfxconf.h b/demos/modules/gdisp/multiple_displays/gfxconf.h new file mode 100644 index 00000000..60467f93 --- /dev/null +++ b/demos/modules/gdisp/multiple_displays/gfxconf.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _GFXCONF_H +#define _GFXCONF_H + +//* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE + +/* GFX sub-systems to turn on */ +#define GFX_USE_GDISP TRUE + +/* Features for the GDISP sub-system. */ +#define GDISP_NEED_VALIDATION TRUE +#define GDISP_NEED_CLIP TRUE +#define GDISP_NEED_TEXT TRUE + +#define GDISP_INCLUDE_FONT_UI2 TRUE + +#define GDISP_TOTAL_DISPLAYS 2 + +/* Uncomment the following lines if you want to use multiple displays on + * different controllers. + * + * Change the definitions to suit your hardware. + * Currently all controllers must use the same pixel format. + * + * Remember that GDISP_TOTAL_DISPLAYS above must match the **Total** + * number of displays in your system across all controllers. + * + * Optionally, you can also specify hardware characteristics that are common to + * all your controllers. This significantly improves code and speed efficiency + * as the program doesn't have to detect the hardware method to use on each call. + * + * Hardware definitions can be set to: + * - TRUE - all controllers support this routine + * - FALSE - no controllers support this routine + * - if not specified then the code auto-detects the hardware. + * + * e.g + * #define GDISP_HARDWARE_STREAM_WRITE FALSE + * #define GDISP_HARDWARE_STREAM_READ FALSE + * #define GDISP_HARDWARE_DRAWPIXEL TRUE + * #define GDISP_HARDWARE_FILLS TRUE + */ +//#define GDISP_TOTAL_CONTROLLERS 2 +//#define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_Win32 +//#define GDISP_CONTROLLER_DISPLAYS 1, 1 +//#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888 + +#endif /* _GFXCONF_H */ diff --git a/demos/modules/gdisp/multiple_displays/main.c b/demos/modules/gdisp/multiple_displays/main.c new file mode 100644 index 00000000..443bee27 --- /dev/null +++ b/demos/modules/gdisp/multiple_displays/main.c @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gfx.h" + +#include + +/* + * This demo demonstrates two ways to talk to multiple displays. + * + * Method 1 is the preferred way however Method 1 would be useful + * when quickly converting existing single display applications. + * + * Note you can combine the methods using method 2 for the first display + * and method 1 for any extra displays. + */ + +#define USE_METHOD_1 FALSE + +#if USE_METHOD_1 + int main(void) { + coord_t width, height; + coord_t display, i, j; + font_t f; + GDisplay *g; + char buf[16]; + + /* Initialize and clear the display */ + gfxInit(); + + /* Get a font to write with */ + f = gdispOpenFont("*"); + + /* Cycle through each display */ + for(display = 0; display < GDISP_TOTAL_DISPLAYS; display++) { + + // Get the specified display + g = gdispGetDisplay(display); + + // Get the screen size + width = gdispGGetWidth(g); + height = gdispGGetHeight(g); + + /* Draw draw draw */ + gdispGDrawBox(g, 10, 10, width/2, height/2, Yellow); + sprintf(buf, "Display %u", display); + gdispGFillStringBox(g, width/2, height/2, width/2-10, height/2-10, buf, f, White, Blue, justifyCenter); + gdispGDrawLine(g, 5, 30, width-50, height-40, Red); + + for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20) + gdispGDrawPixel(g, i, j, White); + } + + while(TRUE) { + gfxSleepMilliseconds(500); + } + } +#else + int main(void) { + coord_t width, height; + coord_t display, i, j; + font_t f; + char buf[16]; + + /* Initialize and clear the display */ + gfxInit(); + + /* Get a font to write with */ + f = gdispOpenFont("*"); + + /* Cycle through each display */ + for(display = 0; display < GDISP_TOTAL_DISPLAYS; display++) { + + // Set the default display to the specified display + gdispSetDisplay(gdispGetDisplay(display)); + + // Get the screen size + width = gdispGetWidth(); + height = gdispGetHeight(); + + /* Draw draw draw */ + gdispDrawBox(10, 10, width/2, height/2, Yellow); + sprintf(buf, "Display %u", display); + gdispFillStringBox(width/2, height/2, width/2-10, height/2-10, buf, f, White, Blue, justifyCenter); + gdispDrawLine(5, 30, width-50, height-40, Red); + + for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20) + gdispDrawPixel(i, j, White); + } + + while(TRUE) { + gfxSleepMilliseconds(500); + } + } +#endif + diff --git a/demos/modules/gdisp/streaming/gfxconf.h b/demos/modules/gdisp/streaming/gfxconf.h new file mode 100644 index 00000000..4038a3fd --- /dev/null +++ b/demos/modules/gdisp/streaming/gfxconf.h @@ -0,0 +1,31 @@ +/** + * This file has a different license to the rest of the GFX system. + * You can copy, modify and distribute this file as you see fit. + * You do not need to publish your source modifications to this file. + * The only thing you are not permitted to do is to relicense it + * under a different license. + */ + +#ifndef _GFXCONF_H +#define _GFXCONF_H + +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE + +/* GFX sub-systems to turn on */ +#define GFX_USE_GDISP TRUE +#define GFX_USE_GMISC TRUE + +/* Features for the GDISP sub-system. */ +#define GDISP_NEED_VALIDATION TRUE +#define GDISP_NEED_STREAMING TRUE + +#define GFX_USE_GMISC TRUE +#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/streaming/main.c b/demos/modules/gdisp/streaming/main.c new file mode 100644 index 00000000..5b857eeb --- /dev/null +++ b/demos/modules/gdisp/streaming/main.c @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket + * Derived from the 2011 IOCCC submission by peter.eastman@gmail.com + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gfx.h" +#include + +/** + * 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) { + coord_t width, height, x, y, radius, ballx, bally, dx, floor; + coord_t minx, miny, maxx, maxy; + coord_t ballcx, ballcy; + color_t colour; + float ii, spin, dy, spinspeed, h, f, g; + + gfxInit(); + #if GDISP_NEED_CONTROL + gdispSetOrientation(GDISP_ROTATE_90); + #endif + + width = gdispGetWidth(); + height = gdispGetHeight(); + + radius=height/5+height%2+1; // The ball radius + ii = 1.0/radius; // radius as easy math + floor=height/5-1; // floor position + spin=0.0; // current spin angle on the ball + spinspeed=0.1; // current spin speed of the ball + ballx=width/2; // ball x position (relative to the ball center) + bally=height/4; // ball y position (relative to the ball center) + dx=.01*width; // motion in the x axis + dy=0.0; // motion in the y axis + ballcx = 12*radius/5; // ball x diameter including the shadow + ballcy = 21*radius/10; // ball y diameter including the shadow + + + minx = miny = 0; maxx = width; maxy = height; // The clipping window for this frame. + + while(1) { + // Draw one frame + gdispStreamStart(minx, miny, maxx-minx, maxy-miny); + for (y=miny; h = (bally-y)*ii, y height-floor) { + if (x < height-y || height-y > width-x) + colour = WALLCOLOR; + else + colour = FLOORCOLOR; + } else if (xwidth-floor) + colour = WALLCOLOR; + else + colour = BACKCOLOR; + + // The ball shadow is darker + if (g*(g+.4)+h*(h+.1) < 1) + colour = gdispBlendColor(colour, Black, SHADOWALPHA); + } + gdispStreamColor(colour); /* pixel to the LCD */ + } + } + gdispStreamStop(); + + // Force a display update if the controller supports it + gdispFlush(); + + // Calculate the new frame size (note this is a drawing optimisation only) + minx = ballx - radius; miny = bally - radius; + maxx = minx + ballcx; maxy = miny + ballcy; + if (dx > 0) maxx += dx; else minx += dx; + if (dy > 0) maxy += dy; else miny += dy; + if (minx < 0) minx = 0; + if (maxx > width) maxx = width; + if (miny < 0) miny = 0; + if (maxy > height) maxy = height; + + // Motion + spin += spinspeed; + ballx += dx; bally += dy; + dx = ballx < radius || ballx > width-radius ? spinspeed=-spinspeed,-dx : dx; + dy = bally > height-1.75*floor ? -.04*height : dy+.002*height; + } +} diff --git a/demos/modules/ginput/touch_driver_test/gfxconf.h b/demos/modules/ginput/touch_driver_test/gfxconf.h index 6e8cc8e1..9b2de86c 100644 --- a/demos/modules/ginput/touch_driver_test/gfxconf.h +++ b/demos/modules/ginput/touch_driver_test/gfxconf.h @@ -30,10 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use - one of these must be defined */ -#define GFX_USE_OS_CHIBIOS TRUE -#define GFX_USE_OS_WIN32 FALSE -#define GFX_USE_OS_POSIX FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE @@ -46,22 +47,10 @@ #define GDISP_NEED_VALIDATION TRUE #define GDISP_NEED_CLIP TRUE #define GDISP_NEED_TEXT TRUE -#define GDISP_NEED_CIRCLE FALSE -#define GDISP_NEED_ELLIPSE FALSE -#define GDISP_NEED_ARC FALSE -#define GDISP_NEED_SCROLL FALSE -#define GDISP_NEED_PIXELREAD FALSE -#define GDISP_NEED_CONTROL FALSE #define GDISP_NEED_MULTITHREAD TRUE -#define GDISP_NEED_ASYNC FALSE -#define GDISP_NEED_MSGAPI FALSE /* Builtin Fonts */ -#define GDISP_INCLUDE_FONT_SMALL FALSE -#define GDISP_INCLUDE_FONT_LARGER FALSE -#define GDISP_INCLUDE_FONT_UI1 FALSE #define GDISP_INCLUDE_FONT_UI2 TRUE -#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE /* Features for the GWIN sub-system. */ #define GWIN_NEED_BUTTON TRUE diff --git a/demos/modules/gtimer/gfxconf.h b/demos/modules/gtimer/gfxconf.h index 1c4a31f8..8786fafe 100644 --- a/demos/modules/gtimer/gfxconf.h +++ b/demos/modules/gtimer/gfxconf.h @@ -30,10 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use - one of these must be defined */ -#define GFX_USE_OS_CHIBIOS TRUE -#define GFX_USE_OS_WIN32 FALSE -#define GFX_USE_OS_POSIX FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GTIMER TRUE diff --git a/demos/modules/gwin/basic/gfxconf.h b/demos/modules/gwin/basic/gfxconf.h index 411ad9cf..70149055 100644 --- a/demos/modules/gwin/basic/gfxconf.h +++ b/demos/modules/gwin/basic/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gwin/button/gfxconf.h b/demos/modules/gwin/button/gfxconf.h index 2199e891..5376bd52 100644 --- a/demos/modules/gwin/button/gfxconf.h +++ b/demos/modules/gwin/button/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gwin/checkbox/gfxconf.h b/demos/modules/gwin/checkbox/gfxconf.h index 9be70462..f9060599 100644 --- a/demos/modules/gwin/checkbox/gfxconf.h +++ b/demos/modules/gwin/checkbox/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gwin/console/gfxconf.h b/demos/modules/gwin/console/gfxconf.h index 42ad5e12..3ada3b89 100644 --- a/demos/modules/gwin/console/gfxconf.h +++ b/demos/modules/gwin/console/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gwin/graph/gfxconf.h b/demos/modules/gwin/graph/gfxconf.h index 684d0e7a..c09bfc6e 100644 --- a/demos/modules/gwin/graph/gfxconf.h +++ b/demos/modules/gwin/graph/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gwin/list/gfxconf.h b/demos/modules/gwin/list/gfxconf.h index ab9cc008..40b509ff 100644 --- a/demos/modules/gwin/list/gfxconf.h +++ b/demos/modules/gwin/list/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gwin/radio/gfxconf.h b/demos/modules/gwin/radio/gfxconf.h index 595042fb..7c3e441e 100644 --- a/demos/modules/gwin/radio/gfxconf.h +++ b/demos/modules/gwin/radio/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gwin/slider/gfxconf.h b/demos/modules/gwin/slider/gfxconf.h index 8a1be49d..fc8d356e 100644 --- a/demos/modules/gwin/slider/gfxconf.h +++ b/demos/modules/gwin/slider/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index 43094bf5..602a559c 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -30,11 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use. One of these must be defined - perferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE //#define GFX_USE_OS_WIN32 FALSE //#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_GDISP TRUE diff --git a/demos/modules/tdisp/gfxconf.h b/demos/modules/tdisp/gfxconf.h index 1f323be3..371a9f44 100644 --- a/demos/modules/tdisp/gfxconf.h +++ b/demos/modules/tdisp/gfxconf.h @@ -30,10 +30,11 @@ #ifndef _GFXCONF_H #define _GFXCONF_H -/* The operating system to use - one of these must be defined */ -#define GFX_USE_OS_CHIBIOS TRUE -#define GFX_USE_OS_WIN32 FALSE -#define GFX_USE_OS_POSIX FALSE +/* The operating system to use. One of these must be defined - preferably in your Makefile */ +//#define GFX_USE_OS_CHIBIOS FALSE +//#define GFX_USE_OS_WIN32 FALSE +//#define GFX_USE_OS_LINUX FALSE +//#define GFX_USE_OS_OSX FALSE /* GFX sub-systems to turn on */ #define GFX_USE_TDISP TRUE -- cgit v1.2.3