From 5b16c0d3d2428c313913babfde26d69545d1d3b7 Mon Sep 17 00:00:00 2001 From: inmarket Date: Tue, 16 Sep 2014 10:06:16 +1000 Subject: [PATCH 1/8] Readme for integration with yaffs2 (coming soon) --- 3rdparty/yaffs2/readme.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 3rdparty/yaffs2/readme.txt diff --git a/3rdparty/yaffs2/readme.txt b/3rdparty/yaffs2/readme.txt new file mode 100644 index 00000000..f34bb5b3 --- /dev/null +++ b/3rdparty/yaffs2/readme.txt @@ -0,0 +1,28 @@ +Yaffs2 source code has not been included in this repository so that you are fully +aware of the license restrictions before using it with uGFX. + +Yaffs2 may be downloaded from http://www.yaffs.net + +This notice has been provided in collaboration with Aleph One - the owners of Yaffs2. +As such it represents an agreement of understanding between Aleph One and uGFX. + +Yaffs2 is distributed under the GPLv2 license. Specifically that means the following… +- You may publish the source code for your project including the yaffs2 and uGFX code + provided that you retain the respective licenses and copyrights in the header + of each source file. +- You may create a binary for your own personal use. +- You MUST NOT distribute a binary that you produce in any form (even in the ROM of + a device) that contains both yaffs2 and uGFX code as that will put you in + breach of either the GPL license or the uGFX license no matter what you do. + See http://ugfx.org/licensing for more details. +- Regardless of whether the project is commercial or non-commercial, you MUST NOT + even compile binaries for other people since that is considered "distribution". + You cannot even compile binaries for a friend, they must build it for themselves. + +If you want to distribute a binary that contains both yaffs2 and uGFX (even in the +ROM of a device) then you must obtain a commercial license of yaffs2 just as you must +obtain a commercial license for uGFX if you want to use it for commercial purposes. + +Just as uGFX provides special licenses for certain open hardware projects, Aleph One +may consider providing special licenses for various special purposes. Please contact +Aleph One at info@aleph1.co.uk for more information. From 90d4fe404dc90b3fcae01e46cdba893fa955cdbe Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 17 Sep 2014 08:41:34 +1000 Subject: [PATCH 2/8] Clean up demo gfxconf.h files that incorrectly specify every option. --- demos/modules/gwin/imagebox/gfxconf.h | 155 +---------------------- demos/modules/gwin/label/gfxconf.h | 170 +------------------------- 2 files changed, 4 insertions(+), 321 deletions(-) diff --git a/demos/modules/gwin/imagebox/gfxconf.h b/demos/modules/gwin/imagebox/gfxconf.h index 4db8be39..d068141a 100644 --- a/demos/modules/gwin/imagebox/gfxconf.h +++ b/demos/modules/gwin/imagebox/gfxconf.h @@ -30,93 +30,20 @@ /////////////////////////////////////////////////////////////////////////// #define GFX_USE_GDISP TRUE -#define GDISP_NEED_AUTOFLUSH FALSE -#define GDISP_NEED_TIMERFLUSH FALSE +//#define GDISP_NEED_AUTOFLUSH FALSE +//#define GDISP_NEED_TIMERFLUSH FALSE #define GDISP_NEED_VALIDATION TRUE #define GDISP_NEED_CLIP TRUE -#define GDISP_NEED_CIRCLE FALSE -#define GDISP_NEED_ELLIPSE FALSE -#define GDISP_NEED_ARC FALSE -#define GDISP_NEED_CONVEX_POLYGON FALSE -#define GDISP_NEED_SCROLL FALSE -#define GDISP_NEED_PIXELREAD FALSE -#define GDISP_NEED_CONTROL FALSE -#define GDISP_NEED_QUERY FALSE #define GDISP_NEED_MULTITHREAD TRUE -#define GDISP_NEED_STREAMING FALSE #define GDISP_NEED_TEXT TRUE - #define GDISP_NEED_ANTIALIAS FALSE - #define GDISP_NEED_UTF8 FALSE - #define GDISP_NEED_TEXT_KERNING FALSE - #define GDISP_INCLUDE_FONT_UI1 FALSE #define GDISP_INCLUDE_FONT_UI2 TRUE - #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 FALSE - #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE - #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE - #define GDISP_INCLUDE_FONT_FIXED_5X8 FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE - #define GDISP_INCLUDE_USER_FONTS FALSE #define GDISP_NEED_IMAGE TRUE - #define GDISP_NEED_IMAGE_NATIVE FALSE #define GDISP_NEED_IMAGE_GIF TRUE #define GDISP_NEED_IMAGE_BMP TRUE - #define GDISP_NEED_IMAGE_BMP_1 FALSE - #define GDISP_NEED_IMAGE_BMP_4 FALSE - #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE - #define GDISP_NEED_IMAGE_BMP_8 FALSE - #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE - #define GDISP_NEED_IMAGE_BMP_16 FALSE #define GDISP_NEED_IMAGE_BMP_24 TRUE - #define GDISP_NEED_IMAGE_BMP_32 FALSE - #define GDISP_NEED_IMAGE_JPG FALSE - #define GDISP_NEED_IMAGE_PNG FALSE - #define GDISP_NEED_IMAGE_ACCOUNTING FALSE - -#define GDISP_NEED_STARTUP_LOGO TRUE #define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE -#define GDISP_LINEBUF_SIZE 128 - -#define GDISP_TOTAL_DISPLAYS 1 - #if GDISP_TOTAL_DISPLAYS > 1 - #define GDISP_HARDWARE_STREAM_WRITE FALSE - #define GDISP_HARDWARE_STREAM_READ FALSE - #define GDISP_HARDWARE_STREAM_POS FALSE - #define GDISP_HARDWARE_DRAWPIXEL FALSE - #define GDISP_HARDWARE_CLEARS FALSE - #define GDISP_HARDWARE_FILLS FALSE - #define GDISP_HARDWARE_BITFILLS FALSE - #define GDISP_HARDWARE_SCROLL FALSE - #define GDISP_HARDWARE_PIXELREAD FALSE - #define GDISP_HARDWARE_CONTROL FALSE - #define GDISP_HARDWARE_QUERY FALSE - #define GDISP_HARDWARE_CLIP FALSE - #endif - -#define GDISP_TOTAL_CONTROLLERS 1 - #if GDISP_TOTAL_CONTROLLERS > 1 - #define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_Win32 - #define GDISP_CONTROLLER_DISPLAYS 1, 1 - #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888 - #endif - -#define GDISP_USE_GFXNET FALSE - #define GDISP_GFXNET_PORT 13001 - #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE - #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE - #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE - /////////////////////////////////////////////////////////////////////////// // GWIN // @@ -125,27 +52,9 @@ #define GWIN_NEED_WINDOWMANAGER TRUE -#define GWIN_NEED_CONSOLE FALSE - #define GWIN_CONSOLE_USE_HISTORY FALSE - #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE - #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE - #define GWIN_CONSOLE_ESCSEQ FALSE - #define GWIN_CONSOLE_USE_BASESTREAM FALSE - #define GWIN_CONSOLE_USE_FLOAT FALSE -#define GWIN_NEED_GRAPH FALSE - #define GWIN_NEED_WIDGET TRUE - #define GWIN_NEED_LABEL FALSE - #define GWIN_NEED_BUTTON FALSE - #define GWIN_BUTTON_LAZY_RELEASE FALSE - #define GWIN_NEED_SLIDER FALSE - #define GWIN_NEED_CHECKBOX FALSE #define GWIN_NEED_IMAGE TRUE #define GWIN_NEED_IMAGE_ANIMATION TRUE - #define GWIN_NEED_RADIO FALSE - #define GWIN_NEED_LIST FALSE - #define GWIN_NEED_LIST_IMAGES FALSE - #define GWIN_NEED_PROGRESSBAR FALSE /////////////////////////////////////////////////////////////////////////// @@ -153,29 +62,16 @@ /////////////////////////////////////////////////////////////////////////// #define GFX_USE_GEVENT TRUE -#define GEVENT_ASSERT_NO_RESOURCE FALSE -#define GEVENT_MAXIMUM_SIZE 32 -#define GEVENT_MAX_SOURCE_LISTENERS 32 - - /////////////////////////////////////////////////////////////////////////// // GTIMER // /////////////////////////////////////////////////////////////////////////// #define GFX_USE_GTIMER TRUE -#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY -#define GTIMER_THREAD_WORKAREA_SIZE 2048 - - /////////////////////////////////////////////////////////////////////////// // GQUEUE // /////////////////////////////////////////////////////////////////////////// #define GFX_USE_GQUEUE TRUE - #define GQUEUE_NEED_ASYNC TRUE -#define GQUEUE_NEED_GSYNC FALSE -#define GQUEUE_NEED_FSYNC FALSE -#define GQUEUE_NEED_BUFFERS FALSE /////////////////////////////////////////////////////////////////////////// // GINPUT // @@ -183,59 +79,12 @@ #define GFX_USE_GINPUT TRUE #define GINPUT_NEED_MOUSE TRUE -#define GINPUT_NEED_KEYBOARD FALSE -#define GINPUT_NEED_TOGGLE FALSE -#define GINPUT_NEED_DIAL FALSE - /////////////////////////////////////////////////////////////////////////// // GFILE // /////////////////////////////////////////////////////////////////////////// #define GFX_USE_GFILE TRUE -#define GFILE_NEED_PRINTG FALSE -#define GFILE_NEED_SCANG FALSE -#define GFILE_NEED_STRINGS FALSE -#define GFILE_NEED_STDIO FALSE - #define GFILE_ALLOW_FLOATS FALSE - #define GFILE_ALLOW_DEVICESPECIFIC FALSE - #define GFILE_MAX_GFILES 3 - -#define GFILE_NEED_MEMFS FALSE #define GFILE_NEED_ROMFS TRUE -#define GFILE_NEED_RAMFS FALSE -#define GFILE_NEED_FATFS FALSE -#define GFILE_NEED_NATIVEFS FALSE -#define GFILE_NEED_CHBIOSFS FALSE - - -/////////////////////////////////////////////////////////////////////////// -// GADC // -/////////////////////////////////////////////////////////////////////////// -#define GFX_USE_GADC FALSE - -#define GADC_MAX_LOWSPEED_DEVICES 4 - - -/////////////////////////////////////////////////////////////////////////// -// GAUDIO // -/////////////////////////////////////////////////////////////////////////// -#define GFX_USE_GAUDIO FALSE - #define GAUDIO_NEED_PLAY FALSE - #define GAUDIO_NEED_RECORD FALSE - - -/////////////////////////////////////////////////////////////////////////// -// GMISC // -/////////////////////////////////////////////////////////////////////////// -#define GFX_USE_GMISC FALSE - -#define GMISC_NEED_ARRAYOPS FALSE -#define GMISC_NEED_FASTTRIG FALSE -#define GMISC_NEED_FIXEDTRIG FALSE -#define GMISC_NEED_INVSQRT FALSE - #define GMISC_INVSQRT_MIXED_ENDIAN FALSE - #define GMISC_INVSQRT_REAL_SLOW FALSE - #endif /* _GFXCONF_H */ diff --git a/demos/modules/gwin/label/gfxconf.h b/demos/modules/gwin/label/gfxconf.h index 59ba809e..568ea4fe 100644 --- a/demos/modules/gwin/label/gfxconf.h +++ b/demos/modules/gwin/label/gfxconf.h @@ -24,98 +24,20 @@ //#define GFX_USE_OS_LINUX TRUE //#define GFX_USE_OS_OSX TRUE - /////////////////////////////////////////////////////////////////////////// // GDISP // /////////////////////////////////////////////////////////////////////////// #define GFX_USE_GDISP TRUE -#define GDISP_NEED_AUTOFLUSH FALSE -#define GDISP_NEED_TIMERFLUSH FALSE +//#define GDISP_NEED_AUTOFLUSH FALSE +//#define GDISP_NEED_TIMERFLUSH FALSE #define GDISP_NEED_VALIDATION TRUE #define GDISP_NEED_CLIP TRUE -#define GDISP_NEED_CIRCLE FALSE -#define GDISP_NEED_ELLIPSE FALSE -#define GDISP_NEED_ARC FALSE -#define GDISP_NEED_CONVEX_POLYGON FALSE -#define GDISP_NEED_SCROLL FALSE -#define GDISP_NEED_PIXELREAD FALSE -#define GDISP_NEED_CONTROL FALSE -#define GDISP_NEED_QUERY FALSE -#define GDISP_NEED_MULTITHREAD FALSE -#define GDISP_NEED_STREAMING FALSE #define GDISP_NEED_TEXT TRUE #define GDISP_NEED_ANTIALIAS TRUE #define GDISP_NEED_UTF8 TRUE #define GDISP_NEED_TEXT_KERNING TRUE - #define GDISP_INCLUDE_FONT_UI1 FALSE - #define GDISP_INCLUDE_FONT_UI2 FALSE - #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE #define GDISP_INCLUDE_FONT_DEJAVUSANS12 TRUE - #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 FALSE - #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE - #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE - #define GDISP_INCLUDE_FONT_FIXED_5X8 FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE - #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE - #define GDISP_INCLUDE_USER_FONTS FALSE - -#define GDISP_NEED_IMAGE FALSE - #define GDISP_NEED_IMAGE_NATIVE FALSE - #define GDISP_NEED_IMAGE_GIF FALSE - #define GDISP_NEED_IMAGE_BMP FALSE - #define GDISP_NEED_IMAGE_BMP_1 FALSE - #define GDISP_NEED_IMAGE_BMP_4 FALSE - #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE - #define GDISP_NEED_IMAGE_BMP_8 FALSE - #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE - #define GDISP_NEED_IMAGE_BMP_16 FALSE - #define GDISP_NEED_IMAGE_BMP_24 FALSE - #define GDISP_NEED_IMAGE_BMP_32 FALSE - #define GDISP_NEED_IMAGE_JPG FALSE - #define GDISP_NEED_IMAGE_PNG FALSE - #define GDISP_NEED_IMAGE_ACCOUNTING FALSE - -#define GDISP_NEED_STARTUP_LOGO FALSE - -#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE -#define GDISP_LINEBUF_SIZE 128 - -#define GDISP_TOTAL_DISPLAYS 1 - #if GDISP_TOTAL_DISPLAYS > 1 - #define GDISP_HARDWARE_STREAM_WRITE FALSE - #define GDISP_HARDWARE_STREAM_READ FALSE - #define GDISP_HARDWARE_STREAM_POS FALSE - #define GDISP_HARDWARE_DRAWPIXEL FALSE - #define GDISP_HARDWARE_CLEARS FALSE - #define GDISP_HARDWARE_FILLS FALSE - #define GDISP_HARDWARE_BITFILLS FALSE - #define GDISP_HARDWARE_SCROLL FALSE - #define GDISP_HARDWARE_PIXELREAD FALSE - #define GDISP_HARDWARE_CONTROL FALSE - #define GDISP_HARDWARE_QUERY FALSE - #define GDISP_HARDWARE_CLIP FALSE - #endif - -#define GDISP_TOTAL_CONTROLLERS 1 - #if GDISP_TOTAL_CONTROLLERS > 1 - #define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_Win32 - #define GDISP_CONTROLLER_DISPLAYS 1, 1 - #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888 - #endif - -#define GDISP_USE_GFXNET FALSE - #define GDISP_GFXNET_PORT 13001 - #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE - #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE - #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE /////////////////////////////////////////////////////////////////////////// @@ -125,59 +47,25 @@ #define GWIN_NEED_WINDOWMANAGER TRUE -#define GWIN_NEED_CONSOLE FALSE - #define GWIN_CONSOLE_USE_HISTORY FALSE - #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE - #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE - #define GWIN_CONSOLE_ESCSEQ FALSE - #define GWIN_CONSOLE_USE_BASESTREAM FALSE - #define GWIN_CONSOLE_USE_FLOAT FALSE -#define GWIN_NEED_GRAPH FALSE -#define GWIN_NEED_WIDGET FALSE - #define GWIN_NEED_HIERARCHY FALSE #define GWIN_NEED_LABEL TRUE #define GWIN_LABEL_ATTRIBUTE TRUE - #define GWIN_NEED_BUTTON FALSE - #define GWIN_BUTTON_LAZY_RELEASE FALSE - #define GWIN_NEED_SLIDER FALSE - #define GWIN_NEED_CHECKBOX FALSE - #define GWIN_NEED_IMAGE FALSE - #define GWIN_NEED_IMAGE_ANIMATION FALSE - #define GWIN_NEED_RADIO FALSE - #define GWIN_NEED_LIST FALSE - #define GWIN_NEED_LIST_IMAGES FALSE - #define GWIN_NEED_PROGRESSBAR FALSE - #define GWIN_NEED_FRAME FALSE - /////////////////////////////////////////////////////////////////////////// // GEVENT // /////////////////////////////////////////////////////////////////////////// #define GFX_USE_GEVENT TRUE -#define GEVENT_ASSERT_NO_RESOURCE FALSE -#define GEVENT_MAXIMUM_SIZE 32 -#define GEVENT_MAX_SOURCE_LISTENERS 32 - - /////////////////////////////////////////////////////////////////////////// // GTIMER // /////////////////////////////////////////////////////////////////////////// #define GFX_USE_GTIMER TRUE -#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY -#define GTIMER_THREAD_WORKAREA_SIZE 2048 - - /////////////////////////////////////////////////////////////////////////// // GQUEUE // /////////////////////////////////////////////////////////////////////////// #define GFX_USE_GQUEUE TRUE #define GQUEUE_NEED_ASYNC TRUE -#define GQUEUE_NEED_GSYNC FALSE -#define GQUEUE_NEED_FSYNC FALSE -#define GQUEUE_NEED_BUFFERS FALSE /////////////////////////////////////////////////////////////////////////// // GINPUT // @@ -185,59 +73,5 @@ #define GFX_USE_GINPUT TRUE #define GINPUT_NEED_MOUSE TRUE -#define GINPUT_NEED_KEYBOARD FALSE -#define GINPUT_NEED_TOGGLE FALSE -#define GINPUT_NEED_DIAL FALSE - - -/////////////////////////////////////////////////////////////////////////// -// GFILE // -/////////////////////////////////////////////////////////////////////////// -#define GFX_USE_GFILE FALSE - -#define GFILE_NEED_PRINTG FALSE -#define GFILE_NEED_SCANG FALSE -#define GFILE_NEED_STRINGS FALSE -#define GFILE_NEED_STDIO FALSE - #define GFILE_ALLOW_FLOATS FALSE - #define GFILE_ALLOW_DEVICESPECIFIC FALSE - #define GFILE_MAX_GFILES 3 - -#define GFILE_NEED_MEMFS FALSE -#define GFILE_NEED_ROMFS FALSE -#define GFILE_NEED_RAMFS FALSE -#define GFILE_NEED_FATFS FALSE -#define GFILE_NEED_NATIVEFS FALSE -#define GFILE_NEED_CHBIOSFS FALSE - - -/////////////////////////////////////////////////////////////////////////// -// GADC // -/////////////////////////////////////////////////////////////////////////// -#define GFX_USE_GADC FALSE - -#define GADC_MAX_LOWSPEED_DEVICES 4 - - -/////////////////////////////////////////////////////////////////////////// -// GAUDIO // -/////////////////////////////////////////////////////////////////////////// -#define GFX_USE_GAUDIO FALSE - #define GAUDIO_NEED_PLAY FALSE - #define GAUDIO_NEED_RECORD FALSE - - -/////////////////////////////////////////////////////////////////////////// -// GMISC // -/////////////////////////////////////////////////////////////////////////// -#define GFX_USE_GMISC FALSE - -#define GMISC_NEED_ARRAYOPS FALSE -#define GMISC_NEED_FASTTRIG FALSE -#define GMISC_NEED_FIXEDTRIG FALSE -#define GMISC_NEED_INVSQRT FALSE - #define GMISC_INVSQRT_MIXED_ENDIAN FALSE - #define GMISC_INVSQRT_REAL_SLOW FALSE - #endif /* _GFXCONF_H */ From 7f8e1a7dead66b8966fd6a4dcebcd559a0754c8a Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 17 Sep 2014 08:44:14 +1000 Subject: [PATCH 3/8] Create a readme for the gdisp drivers directory listing what hardware each driver can drive. --- drivers/gdisp/readme.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 drivers/gdisp/readme.txt diff --git a/drivers/gdisp/readme.txt b/drivers/gdisp/readme.txt new file mode 100644 index 00000000..5cb576a0 --- /dev/null +++ b/drivers/gdisp/readme.txt @@ -0,0 +1,28 @@ +A list of current display drivers: + +ED060SC4 - E-Ink display +framebuffer - Supports any non-palletized, non-bitpacked color display with a framebuffer +HX8347D - Mid-sized color LCD displays eg RGB565 320x240 +ILI9320 - Mid-sized color LCD displays eg RGB565 320x240 +ILI9325 - Mid-sized color LCD displays eg RGB565 320x240 +ILI9341 - Mid-sized color LCD displays eg RGB565 320x240 +ILI93xx - Mid-sized color LCD displays eg RGB565 320x240 (attempt at a common driver) +ILI9481 - Mid-sized color LCD displays eg RGB565 320x240 +LGD4532 - Mid-sized color LCD displays eg RGB565 320x240 +Nokia6610GE8 - Small (130x130) 12bit color LCD +Nokia6610GE12 - Small (130x130) 12bit color LCD (untested) +PCD8544 - Small monochrome LCD +PCF8812 - Small monochrome LCD +R61505U - Mid-sized color LCD displays eg RGB565 320x240 +RA8875 - Mid-sized color LCD displays eg RGB565 320x240 +S6D1121 - Mid-sized color LCD displays eg RGB565 320x240 +SPFD54124B - Mid-sized color LCD displays eg RGB565 320x240 +SSD1289 - Mid-sized color LCD displays eg RGB565 320x240 +SSD1306 - Small monochrome LCD +SSD1963 - Mid-sized color LCD displays eg RGB565 320x240 +SSD2119 - Mid-sized color LCD displays eg RGB565 320x240 +ST7565 - Small monochrome LCD +TestStub - NULL driver just to test compile +uGFXnet - Remote Network display (in drivers/multiple/uGFXnet directory) +Win32 - Microsoft Windows (in drivers/multiple/Win32 directory) +X - X Windows (Xlib) (in drivers/multiple/X directory) From 036ad5d3dd368d2836ed0148143da786f48f15e0 Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 17 Sep 2014 08:43:11 +1000 Subject: [PATCH 4/8] SImplify the options for multiple displays. This will also be more compatible with newmouse infrastructure --- .../modules/gdisp/multiple_displays/gfxconf.h | 28 +++-- demos/modules/gdisp/multiple_displays/main.c | 10 +- drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c | 62 +++++----- gfxconf.example.h | 6 +- src/gdisp/driver.h | 40 +++---- src/gdisp/gdisp_gdisp.c | 111 +++++++----------- src/gdisp/sys_defs.h | 28 +++-- src/gdisp/sys_options.h | 50 +++----- src/gdisp/sys_rules.h | 13 +- 9 files changed, 155 insertions(+), 193 deletions(-) diff --git a/demos/modules/gdisp/multiple_displays/gfxconf.h b/demos/modules/gdisp/multiple_displays/gfxconf.h index 60467f93..959f1d0b 100644 --- a/demos/modules/gdisp/multiple_displays/gfxconf.h +++ b/demos/modules/gdisp/multiple_displays/gfxconf.h @@ -46,16 +46,20 @@ #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. +/* You must either define GDISP_TOTAL_DISPLAYS or GDISP_DRIVER_LIST for multiple displays. + * You cannot define both! * - * Change the definitions to suit your hardware. - * Currently all controllers must use the same pixel format. + * Defining GDISP_TOTAL_DISPLAYS will create multiple instances of the one default driver. + * Defining GDISP_DRIVER_LIST allows you to specify multiple different drivers. * - * Remember that GDISP_TOTAL_DISPLAYS above must match the **Total** - * number of displays in your system across all controllers. + * Extra Notes for GDISP_DRIVER_LIST: + *----------------------------------- + * + * The same controller can appear more than once in the list. + * + * You must specify a GDISP_PIXELFORMAT that the application will work in. This + * is translated into each drivers internal pixel format by the driver. You the + * pixel format that is most common accross your drivers (for efficiency). * * Optionally, you can also specify hardware characteristics that are common to * all your controllers. This significantly improves code and speed efficiency @@ -72,9 +76,9 @@ * #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 +#define GDISP_TOTAL_DISPLAYS 2 + +//#define GDISP_DRIVER_LIST GDISPVMT_Win32, GDISPVMT_Win32 +//#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 index 4e8a5a08..c4c37bed 100644 --- a/demos/modules/gdisp/multiple_displays/main.c +++ b/demos/modules/gdisp/multiple_displays/main.c @@ -46,7 +46,7 @@ #if USE_METHOD_1 int main(void) { coord_t width, height; - coord_t display, i, j; + coord_t display, i, j, cnt; font_t f; GDisplay *g; char buf[16]; @@ -58,7 +58,8 @@ f = gdispOpenFont("*"); /* Cycle through each display */ - for(display = 0; display < GDISP_TOTAL_DISPLAYS; display++) { + cnt = gdispGetDisplayCount(); + for(display = 0; display < cnt; display++) { // Get the specified display g = gdispGetDisplay(display); @@ -84,7 +85,7 @@ #else int main(void) { coord_t width, height; - coord_t display, i, j; + coord_t display, i, j, cnt; font_t f; char buf[16]; @@ -95,7 +96,8 @@ f = gdispOpenFont("*"); /* Cycle through each display */ - for(display = 0; display < GDISP_TOTAL_DISPLAYS; display++) { + cnt = gdispGetDisplayCount(); + for(display = 0; display < cnt; display++) { // Set the default display to the specified display gdispSetDisplay(gdispGetDisplay(display)); diff --git a/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c b/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c index 802f2822..e96ad3b2 100644 --- a/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c +++ b/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c @@ -205,20 +205,18 @@ static DECLARE_THREAD_FUNCTION(NetThread, param) { gfxHalt("GDISP: uGFXnet - Accept failed"); // Look for a display that isn't connected - for(disp = 0; disp < GDISP_TOTAL_DISPLAYS; disp++) { - if (!(g = gdispGetDisplay(disp))) - continue; - #if GDISP_TOTAL_CONTROLLERS > 1 - // Ignore displays for other controllers - if (g->vmt != &GDISPVMT_uGFXnet) - continue; - #endif + for(g = 0; (g = (GDisplay *)gdriverGetNext(GDRIVER_TYPE_DISPLAY, (GDriver *)g));) { + // Ignore displays for other controllers + #ifdef GDISP_DRIVER_LIST + if (gvmt(g) != &GDISPVMT_uGFXnet) + continue; + #endif if (!(g->flags & GDISP_FLG_CONNECTED)) break; } // Was anything found? - if (disp >= GDISP_TOTAL_DISPLAYS) { + if (!g) { // No Just close the connection closesocket(clientfd); gfxHalt("GDISP: uGFXnet - Can't find display for connection"); @@ -275,21 +273,19 @@ static DECLARE_THREAD_FUNCTION(NetThread, param) { if((clientfd = accept(listenfd, (struct sockaddr *)&addr, &len)) == (SOCKET_TYPE)-1) gfxHalt("GDISP: uGFXnet - Accept failed"); - // Look for a display that isn't connected - for(disp = 0; disp < GDISP_TOTAL_DISPLAYS; disp++) { - if (!(g = gdispGetDisplay(disp))) - continue; - #if GDISP_TOTAL_CONTROLLERS > 1 - // Ignore displays for other controllers - if (g->vmt != &GDISPVMT_uGFXnet) - continue; - #endif - if (!(g->flags & GDISP_FLG_CONNECTED)) - break; - } + // Look for a display that isn't connected + for(g = 0; (g = (GDisplay *)gdriverGetNext(GDRIVER_TYPE_DISPLAY, (GDriver *)g));) { + // Ignore displays for other controllers + #ifdef GDISP_DRIVER_LIST + if (gvmt(g) != &GDISPVMT_uGFXnet) + continue; + #endif + if (!(g->flags & GDISP_FLG_CONNECTED)) + break; + } // Was anything found? - if (disp >= GDISP_TOTAL_DISPLAYS) { + if (!g) { // No Just close the connection closesocket(clientfd); //printf(New connection from %s on socket %d rejected as all displays are already connected\n", inet_ntoa(addr.sin_addr), clientfd); @@ -332,19 +328,17 @@ static DECLARE_THREAD_FUNCTION(NetThread, param) { // Handle data from a client // Look for a display that is connected and the socket descriptor matches - for(disp = 0; disp < GDISP_TOTAL_DISPLAYS; disp++) { - if (!(g = gdispGetDisplay(disp))) - continue; - #if GDISP_TOTAL_CONTROLLERS > 1 - // Ignore displays for other controllers - if (g->vmt != &GDISPVMT_uGFXnet) - continue; - #endif + for(g = 0; (g = (GDisplay *)gdriverGetNext(GDRIVER_TYPE_DISPLAY, (GDriver *)g));) { + // Ignore displays for other controllers + #ifdef GDISP_DRIVER_LIST + if (gvmt(g) != &GDISPVMT_uGFXnet) + continue; + #endif priv = g->priv; if ((g->flags & GDISP_FLG_CONNECTED) && priv->netfd == i) break; - } - if (disp >= GDISP_TOTAL_DISPLAYS) + } + if (!g) gfxHalt("GDISP: uGFXnet - Got data from unrecognized connection"); if ((g->flags & GDISP_FLG_HAVEDATA)) { @@ -538,7 +532,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { // Make everything relative to the start of the line buffer = g->p.ptr; buffer += g->p.x2*g->p.y1; - + priv = g->priv; buf[0] = GNETCODE_BLIT; buf[1] = g->p.x; @@ -583,7 +577,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { // Now wait for a reply while(!(g->flags & GDISP_FLG_HAVEDATA) || priv->data[0] != GNETCODE_READ) gfxSleepMilliseconds(1); - + data = gdispNative2Color(priv->data[1]); g->flags &= ~GDISP_FLG_HAVEDATA; diff --git a/gfxconf.example.h b/gfxconf.example.h index 9b5ba477..205c79d3 100644 --- a/gfxconf.example.h +++ b/gfxconf.example.h @@ -108,8 +108,8 @@ //#define GDISP_TOTAL_DISPLAYS 1 -//#define GDISP_TOTAL_CONTROLLERS 1 -// #if GDISP_TOTAL_CONTROLLERS > 1 +//#define GDISP_DRIVER_LIST GDISPVMT_Win32, GDISPVMT_Win32 +// #ifdef GDISP_DRIVER_LIST // // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability // #define GDISP_HARDWARE_STREAM_WRITE FALSE // #define GDISP_HARDWARE_STREAM_READ FALSE @@ -124,8 +124,6 @@ // #define GDISP_HARDWARE_QUERY FALSE // #define GDISP_HARDWARE_CLIP FALSE -// #define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_Win32 -// #define GDISP_CONTROLLER_DISPLAYS 1, 1 // #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888 // #endif diff --git a/src/gdisp/driver.h b/src/gdisp/driver.h index 5213e5ae..288f9a65 100644 --- a/src/gdisp/driver.h +++ b/src/gdisp/driver.h @@ -24,7 +24,7 @@ // Our special auto-detect hardware code which uses the VMT. #define HARDWARE_AUTODETECT 2 -#if GDISP_TOTAL_CONTROLLERS > 1 && !defined(GDISP_DRIVER_VMT) +#if defined(GDISP_DRIVER_LIST) && !defined(GDISP_DRIVER_VMT) // Multiple controllers the default is to hardware detect #define HARDWARE_DEFAULT HARDWARE_AUTODETECT #else @@ -40,7 +40,7 @@ * @brief The display hardware can benefit from being de-initialized when usage is complete. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined * @note This is most useful for displays such as remote network displays. */ #ifndef GDISP_HARDWARE_DEINIT @@ -51,7 +51,7 @@ * @brief The display hardware can benefit from being flushed. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined * @note Some controllers ** require ** the application to flush */ #ifndef GDISP_HARDWARE_FLUSH @@ -62,7 +62,7 @@ * @brief Hardware streaming writing is supported. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined * @note Either GDISP_HARDWARE_STREAM_WRITE or GDISP_HARDWARE_DRAWPIXEL must be provided by each driver */ #ifndef GDISP_HARDWARE_STREAM_WRITE @@ -73,7 +73,7 @@ * @brief Hardware streaming reading of the display surface is supported. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined * */ #ifndef GDISP_HARDWARE_STREAM_READ @@ -84,7 +84,7 @@ * @brief Hardware supports setting the cursor position within the stream window. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined * @note This is used to optimise setting of individual pixels within a stream window. * It should therefore not be implemented unless it is cheaper than just setting * a new window. @@ -97,7 +97,7 @@ * @brief Hardware accelerated draw pixel. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined * @note Either GDISP_HARDWARE_STREAM_WRITE or GDISP_HARDWARE_DRAWPIXEL must be provided by the driver */ #ifndef GDISP_HARDWARE_DRAWPIXEL @@ -108,7 +108,7 @@ * @brief Hardware accelerated screen clears. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined * @note This clears the entire display surface regardless of the clipping area currently set */ #ifndef GDISP_HARDWARE_CLEARS @@ -119,7 +119,7 @@ * @brief Hardware accelerated rectangular fills. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined */ #ifndef GDISP_HARDWARE_FILLS #define GDISP_HARDWARE_FILLS HARDWARE_DEFAULT @@ -129,7 +129,7 @@ * @brief Hardware accelerated fills from an image. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined */ #ifndef GDISP_HARDWARE_BITFILLS #define GDISP_HARDWARE_BITFILLS HARDWARE_DEFAULT @@ -139,7 +139,7 @@ * @brief Hardware accelerated scrolling. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined */ #ifndef GDISP_HARDWARE_SCROLL #define GDISP_HARDWARE_SCROLL HARDWARE_DEFAULT @@ -149,7 +149,7 @@ * @brief Reading back of pixel values. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined */ #ifndef GDISP_HARDWARE_PIXELREAD #define GDISP_HARDWARE_PIXELREAD HARDWARE_DEFAULT @@ -159,7 +159,7 @@ * @brief The driver supports one or more control commands. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined */ #ifndef GDISP_HARDWARE_CONTROL #define GDISP_HARDWARE_CONTROL HARDWARE_DEFAULT @@ -169,7 +169,7 @@ * @brief The driver supports a non-standard query. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined */ #ifndef GDISP_HARDWARE_QUERY #define GDISP_HARDWARE_QUERY HARDWARE_DEFAULT @@ -179,7 +179,7 @@ * @brief The driver supports a clipping in hardware. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT * - * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_DRIVER_LIST is defined * @note If this is defined the driver must perform its own clipping on all calls to * the driver and respond appropriately if a parameter is outside the display area. * @note If this is not defined then the software ensures that all calls to the @@ -310,16 +310,16 @@ typedef struct GDISPVMT { } GDISPVMT; // Do we need function definitions or macro's (via the VMT) -#if GDISP_TOTAL_CONTROLLERS <= 1 || defined(GDISP_DRIVER_VMT) || defined(__DOXYGEN__) +#if !defined(GDISP_DRIVER_LIST) || defined(GDISP_DRIVER_VMT) || defined(__DOXYGEN__) #ifdef __cplusplus extern "C" { #endif // Should the driver routines should be static or not - #if GDISP_TOTAL_CONTROLLERS <= 1 - #define LLDSPEC + #if defined(GDISP_DRIVER_LIST) + #define LLDSPEC static #else - #define LLDSPEC static + #define LLDSPEC #endif /** @@ -611,7 +611,7 @@ typedef struct GDISPVMT { #endif // If we are not using multiple displays then hard-code the VMT name - #ifndef GDISP_CONTROLLER_LIST + #if !defined(GDISP_DRIVER_LIST) #undef GDISP_DRIVER_VMT #define GDISP_DRIVER_VMT GDISPVMT_OnlyOne #endif diff --git a/src/gdisp/gdisp_gdisp.c b/src/gdisp/gdisp_gdisp.c index a34788b2..0e5cacb5 100644 --- a/src/gdisp/gdisp_gdisp.c +++ b/src/gdisp/gdisp_gdisp.c @@ -566,45 +566,24 @@ static void line_clip(GDisplay *g) { void _gdispInit(void) { - // Both GDISP_CONTROLLER_LIST and GDISP_CONTROLLER_DISPLAYS are defined - create the required numbers of each controller - #if defined(GDISP_CONTROLLER_LIST) && defined(GDISP_CONTROLLER_DISPLAYS) - { - int i, cnt; - - extern GDriverVMTList GDISP_CONTROLLER_LIST; - static const struct GDriverVMT const * dclist[GDISP_TOTAL_CONTROLLERS] = {GDISP_CONTROLLER_LIST}; - static const unsigned dnlist[GDISP_TOTAL_CONTROLLERS] = {GDISP_CONTROLLER_DISPLAYS}; - - for(i = 0; i < GDISP_TOTAL_CONTROLLERS; i++) { - for(cnt = dnlist[i]; cnt; cnt--) - gdriverRegister(dclist[i]); - } - } - - // Only GDISP_CONTROLLER_LIST is defined - create one of each controller - #elif defined(GDISP_CONTROLLER_LIST) + // GDISP_DRIVER_LIST is defined - create each driver instance + #if defined(GDISP_DRIVER_LIST) { int i; - extern GDriverVMTList GDISP_CONTROLLER_LIST; - static const struct GDriverVMT const * dclist[GDISP_TOTAL_CONTROLLERS] = {GDISP_CONTROLLER_LIST}; + extern GDriverVMTList GDISP_DRIVER_LIST; + static const struct GDriverVMT const * dclist[] = {GDISP_DRIVER_LIST}; - for(i = 0; i < GDISP_TOTAL_CONTROLLERS; i++) + for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++) gdriverRegister(dclist[i]); } - - // Only GDISP_TOTAL_DISPLAYS is defined - create the required number of the one controller #elif GDISP_TOTAL_DISPLAYS > 1 { - int cnt; + int i; - extern GDriverVMTList GDISPVMT_OnlyOne; - - for(cnt = 0; cnt < GDISP_TOTAL_DISPLAYS; cnt++) + for(i = 0; i < GDISP_TOTAL_DISPLAYS; i++) gdriverRegister(GDISPVMT_OnlyOne); } - - // One and only one display #else { extern GDriverVMTList GDISPVMT_OnlyOne; @@ -715,10 +694,6 @@ void _gdispDeInitDriver(GDriver *g) { #undef gd } -GDisplay *gdispGetDisplay(unsigned display) { - return (GDisplay *)gdriverGetInstance(GDRIVER_TYPE_DISPLAY, display); -} - void gdispSetDisplay(GDisplay *g) { if (g) GDISP = g; } @@ -1001,7 +976,7 @@ void gdispGDrawPixel(GDisplay *g, coord_t x, coord_t y, color_t color) { autoflush(g); MUTEX_EXIT(g); } - + void gdispGDrawLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color) { MUTEX_ENTER(g); g->p.x = x0; @@ -1110,7 +1085,7 @@ void gdispGFillArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c autoflush_stopdone(g); MUTEX_EXIT(g); } - + void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx, coord_t srcy, coord_t srccx, const pixel_t *buffer) { MUTEX_ENTER(g); @@ -1246,7 +1221,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c } #endif } - + #if GDISP_NEED_CLIP || GDISP_NEED_VALIDATION void gdispGSetClip(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy) { MUTEX_ENTER(g); @@ -1400,7 +1375,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c MUTEX_EXIT(g); } #endif - + #if GDISP_NEED_ELLIPSE void gdispGFillEllipse(GDisplay *g, coord_t x, coord_t y, coord_t a, coord_t b, color_t color) { coord_t dx, dy; @@ -2662,7 +2637,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co } } } - + static int32_t rounding_div(const int32_t n, const int32_t d) { if ((n < 0) != (d < 0)) @@ -2670,23 +2645,23 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co else return (n + d/2) / d; } - + /* Find a vector (nx, ny) that is perpendicular to (dx, dy) and has length * equal to 'norm'. */ static void get_normal_vector(coord_t dx, coord_t dy, coord_t norm, coord_t *nx, coord_t *ny) { int32_t dx2, dy2, len_sq, norm_sq, norm_sq2; int div, step, best, delta, abs_delta; - + dx2 = dx; dy2 = dy; norm_sq = (int32_t)norm * norm; norm_sq2 = norm_sq * 512; - + /* Scale dx2 and dy2 so that * len_sq / 2 <= norm_sq * 512 <= len_sq * 2. * The scaling by 512 is to yield higher accuracy in division later. */ len_sq = dx2 * dx2 + dy2 * dy2; - + if (len_sq < norm_sq2) { while (len_sq && len_sq < norm_sq2) @@ -2701,69 +2676,69 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co len_sq >>= 2; dx2 >>= 1; dy2 >>= 1; } } - + /* Now find the divider div so that * len_sq / div^2 == norm_sq i.e. div = sqrt(len_sq / norm_sq) * * This is done using bisection search to avoid the need for floating * point sqrt. - * + * * Based on previous scaling, we know that * len_sq / 2 <= norm_sq * 512 <=> div <= sqrt(1024) = 32 * len_sq * 2 >= norm_sq * 512 <=> div >= sqrt(256) = 16 */ div = 24; step = 8; best = 256; - + for (;;) { dx = dx2 / div; dy = dy2 / div; len_sq = dx*dx + dy*dy; - + delta = len_sq - norm_sq; - + abs_delta = (delta >= 0) ? delta : -delta; - + if (abs_delta < best) { *nx = dy; *ny = -dx; best = abs_delta; } - + if (delta > 0) div += step; else if (delta < 0) div -= step; else if (delta == 0) break; - + if (step == 0) break; else step >>= 1; /* Do one round with step = 0 to calculate final result. */ } } - + void gdispGDrawThickLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color, coord_t width, bool_t round) { coord_t dx, dy, nx = 0, ny = 0; - + /* Compute the direction vector for the line */ dx = x1 - x0; dy = y1 - y0; - + /* Draw a small dot if the line length is zero. */ if (dx == 0 && dy == 0) dx += 1; - + /* Compute a normal vector with length 'width'. */ get_normal_vector(dx, dy, width, &nx, &ny); - + /* Handle 1px wide lines gracefully */ if (nx == 0 && ny == 0) nx = 1; - + /* Offset the x0,y0 by half the width of the line. This way we * can keep the width of the line accurate even if it is not evenly * divisible by 2. @@ -2772,11 +2747,11 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co x0 -= rounding_div(nx, 2); y0 -= rounding_div(ny, 2); } - + /* Fill in the point array */ if (!round) { /* We use 4 points for the basic line shape: - * + * * pt1 pt2 * (+n) ------------------------------------ (d+n) * | | @@ -2784,7 +2759,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co * pt0 pt3 */ point pntarray[4]; - + pntarray[0].x = 0; pntarray[0].y = 0; pntarray[1].x = nx; @@ -2793,7 +2768,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co pntarray[2].y = dy + ny; pntarray[3].x = dx; pntarray[3].y = dy; - + gdispGFillConvexPoly(g, x0, y0, pntarray, 4, color); } else { /* We use 4 points for basic shape, plus 4 extra points for ends: @@ -2808,26 +2783,26 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co */ point pntarray[8]; coord_t nx2, ny2; - + /* Magic numbers: * 75/256 = sin(45) / (1 + sqrt(2)) diagonal octagon segments * 106/256 = 1 / (1 + sqrt(2)) octagon side * 53/256 = 0.5 / (1 + sqrt(2)) half of octagon side * 150/256 = 1 - 1 / (1 + sqrt(2)) octagon height minus one side */ - + /* Rotate the normal vector 45 deg counter-clockwise and reduce * to 1 / (1 + sqrt(2)) length, for forming octagonal ends. */ nx2 = rounding_div((nx * 75 + ny * 75), 256); ny2 = rounding_div((-nx * 75 + ny * 75), 256); - + /* Offset and extend the line so that the center of the octagon * is at the specified points. */ x0 += ny * 53 / 256; y0 -= nx * 53 / 256; dx -= ny * 106 / 256; dy += nx * 106 / 256; - + /* Now fill in the points by summing the calculated vectors. */ pntarray[0].x = 0; pntarray[0].y = 0; @@ -2845,7 +2820,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co pntarray[6].y = dy + ny * 150/256 - ny2; pntarray[7].x = dx; pntarray[7].y = dy; - + gdispGFillConvexPoly(g, x0, y0, pntarray, 8, color); } } @@ -3099,19 +3074,19 @@ color_t gdispBlendColor(color_t fg, color_t bg, uint8_t alpha) uint16_t fg_ratio = alpha + 1; uint16_t bg_ratio = 256 - alpha; uint16_t r, g, b; - + r = RED_OF(fg) * fg_ratio; g = GREEN_OF(fg) * fg_ratio; b = BLUE_OF(fg) * fg_ratio; - + r += RED_OF(bg) * bg_ratio; g += GREEN_OF(bg) * bg_ratio; b += BLUE_OF(bg) * bg_ratio; - + r >>= 8; g >>= 8; b >>= 8; - + return RGB2COLOR(r, g, b); } diff --git a/src/gdisp/sys_defs.h b/src/gdisp/sys_defs.h index d67fdcee..0d51d639 100644 --- a/src/gdisp/sys_defs.h +++ b/src/gdisp/sys_defs.h @@ -111,7 +111,7 @@ extern GDisplay *GDISP; /* Defines relating to the display hardware */ /*===========================================================================*/ -#if GDISP_TOTAL_CONTROLLERS <= 1 +#if !defined(GDISP_DRIVER_LIST) // Pull in the default hardware configuration for a single controller. // If we have multiple controllers the settings must be set in the // users gfxconf.h file. @@ -133,7 +133,7 @@ extern GDisplay *GDISP; * @details It generally defaults to the hardware pixel format. * @note This doesn't need to match the hardware pixel format. * It is definitely more efficient when it does. - * @note When GDISP_TOTAL_CONTROLLERS > 1, this must + * @note When GDISP_DRIVER_LIST is defined, this must * be explicitly defined and you should ensure the best match * with your hardware across all devices. */ @@ -213,13 +213,13 @@ color_t gdispContrastColor(color_t color); * @note The GDISP variable contains the display used by the gdispXxxx routines * as opposed to the gdispGXxxx routines which take an explicit display * parameter. - * @note Displays are numbered from 0 to GDISP_TOTAL_DISPLAYS - 1 + * @note Displays are numbered from 0 to @p gdispGetDisplayCount() - 1 * * @param[in] display The display number (0..n) * * @api */ -GDisplay *gdispGetDisplay(unsigned display); +#define gdispGetDisplay(display) ((GDisplay *)gdriverGetInstance(GDRIVER_TYPE_DISPLAY, display)) /** * @brief Set the current default display to the specified display @@ -235,6 +235,14 @@ GDisplay *gdispGetDisplay(unsigned display); */ void gdispSetDisplay(GDisplay *g); +/** + * @brief Get the count of currently active displays + * @return The count of displays currently in the system + * + * @note Displays are numbered from 0 to @p gdispGetDisplayCount() - 1 + */ +#define gdispGetDisplayCount() gdriverInstanceCount(GDRIVER_TYPE_DISPLAY) + /* Property Functions */ /** @@ -683,20 +691,20 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co */ void gdispGFillConvexPoly(GDisplay *g, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt, color_t color); #define gdispFillConvexPoly(x,y,p,i,c) gdispGFillConvexPoly(GDISP,x,y,p,i,c) - + /** * @brief Draw a line with a specified thickness * @details The line thickness is specified in pixels. The line ends can * be selected to be either flat or round. * @note Uses gdispGFillConvexPoly() internally to perform the drawing. - * + * * @param[in] g The display to use * @param[in] x0,y0 The start position * @param[in] x1,y1 The end position * @param[in] color The color to use * @param[in] width The width of the line * @param[in] round Use round ends for the line - * + * * @api */ void gdispGDrawThickLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color, coord_t width, bool_t round); @@ -857,13 +865,13 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co * @brief Make a scaled copy of an existing font. * @details Allocates memory for new font metadata using gfxAlloc, remember to close font after use! * @return A new font or NULL if out of memory. - * + * * @param[in] font The base font to use. * @param[in] scale_x The scale factor in horizontal direction. * @param[in] scale_y The scale factor in vertical direction. */ font_t gdispScaleFont(font_t font, uint8_t scale_x, uint8_t scale_y); - + /** * @brief Get the name of the specified font. * @returns The name of the font. @@ -907,7 +915,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co #define gdispFillRoundedBox(x,y,cx,cy,r,c) gdispGFillRoundedBox(GDISP,x,y,cx,cy,r,c) #endif -/* +/* * Macro definitions */ diff --git a/src/gdisp/sys_options.h b/src/gdisp/sys_options.h index 466bbb98..855f22ff 100644 --- a/src/gdisp/sys_options.h +++ b/src/gdisp/sys_options.h @@ -184,42 +184,26 @@ * @{ */ /** - * @brief The total number of displays. - * @note This can be on just one type of controller or spread across several different controllers + * @brief The total number of displays using the default driver. + * @note If you want to use multiple displays either set GDISP_TOTAL_DISPLAYS or GDISP_DRIVER_LIST + * but not both. */ #ifndef GDISP_TOTAL_DISPLAYS #define GDISP_TOTAL_DISPLAYS 1 #endif - /** - * @brief The total number of controllers. - * @note If this is greater than one, all the hardware acceleration options below - * and the pixel format must be manually specified in your gfxconf.h along with - * @p GDISP_CONTROLLER_LIST. See the gdisp_lld_config.h in each driver to get a list - * of hardware capabilities for each driver in order to work out the common set across - * all the controllers you want to use. - */ - #ifndef GDISP_TOTAL_CONTROLLERS - #define GDISP_TOTAL_CONTROLLERS 1 - #endif - #if defined(__DOXYGEN__) /** - * @brief The list of controllers. - * @note This is required if @p GDISP_TOTAL_CONTROLLERS is greater than one. - * @note The number of entries must match @p GDISP_TOTAL_CONTROLLERS. - * @note See the gdisp_lld.c in each driver (near the top) to get the name of the VMT for a driver. - * @note Replace this example with your own definition in your gfxconf.h file. + * @brief The list of display drivers. + * @note Replace this example with your own definition in your gfxconf.h file. See the gdisp_lld.c + * in each driver (near the top) to get the name of the VMT for a driver. + * @note The same driver can occur more than once in the list to create an extra instance of that driver. + * @note If defining this you must also define GDISP_PIXELFORMAT for your application to use. + * Choose a value that is most common accross all your drivers for efficiency. + * @note If using this you may optionally define the GDISP_HARDWARE_xxx values as either TRUE or FALSE. + * Doing this causes GDISP to assume that all (TRUE) or none (FALSE) of the listed drivers have that + * capability. This can help improve drawing speed and efficiency. */ - #define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_SSD1963 - /** - * @brief The number of displays for each controller. - * @note This is required if @p GDISP_TOTAL_CONTROLLERS is greater than one. - * @note The number of entries must match @p GDISP_TOTAL_CONTROLLERS. - * @note The sum of all the display counts must equal @p GDISP_TOTAL_DISPLAYS (3 for this example) - * or bad things will happen. - * @note Replace this example with your own definition in your gfxconf.h file. - */ - #define GDISP_CONTROLLER_DISPLAYS 2, 1 + #define GDISP_DRIVER_LIST GDISPVMT_Win32, GDISPVMT_SSD1963 #endif /** * @} @@ -272,7 +256,7 @@ #endif /** * @} - * + * * @name GDISP Text Rendering Options * @{ */ @@ -283,7 +267,7 @@ #ifndef GDISP_NEED_UTF8 #define GDISP_NEED_UTF8 FALSE #endif - + /** * @brief Enable kerning for font rendering (improves character placement). * @details Defaults to FALSE @@ -291,7 +275,7 @@ #ifndef GDISP_NEED_TEXT_KERNING #define GDISP_NEED_TEXT_KERNING FALSE #endif - + /** * @brief Enable antialiased font support * @details Defaults to FALSE @@ -299,7 +283,7 @@ #ifndef GDISP_NEED_ANTIALIAS #define GDISP_NEED_ANTIALIAS FALSE #endif - + /** * @} * diff --git a/src/gdisp/sys_rules.h b/src/gdisp/sys_rules.h index eca55ce3..90b07138 100644 --- a/src/gdisp/sys_rules.h +++ b/src/gdisp/sys_rules.h @@ -24,15 +24,12 @@ #undef GFX_USE_GDRIVER #define GFX_USE_GDRIVER TRUE #endif - #if GDISP_TOTAL_CONTROLLERS > 1 - #ifndef GDISP_CONTROLLER_LIST - #error "GDISP Multiple Controllers: You must specify a value for GDISP_CONTROLLER_LIST" - #endif - #ifndef GDISP_CONTROLLER_DISPLAYS - #error "GDISP Multiple Controllers: You must specify a value for GDISP_CONTROLLER_DISPLAYS" - #endif + #if defined(GDISP_DRIVER_LIST) + #if GDISP_TOTAL_DISPLAYS != 1 + #error "GDISP Multiple Drivers: You can't specify both GDISP_TOTAL_DISPLAYS and GDISP_DRIVER_LIST + #endif #ifndef GDISP_PIXELFORMAT - #error "GDISP Multiple Controllers: You must specify a value for GDISP_PIXELFORMAT" + #error "GDISP Multiple Drivers: You must specify a value for GDISP_PIXELFORMAT when using GDISP_DRIVER_LIST" #endif #endif #if GDISP_NEED_AUTOFLUSH && GDISP_NEED_TIMERFLUSH From c28c4645c0a1fb6f298e5ca2e8e843991b6adaef Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 17 Sep 2014 09:32:09 +1000 Subject: [PATCH 5/8] FATFS and PETITFS compile error fix (caused by prior file renaming). --- src/gfile/gfile_fs_fatfs.c | 2 +- src/gfile/gfile_fs_petitfs.c | 2 +- src/gfile/sys_options.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gfile/gfile_fs_fatfs.c b/src/gfile/gfile_fs_fatfs.c index 2e4ef52b..c76b0659 100644 --- a/src/gfile/gfile_fs_fatfs.c +++ b/src/gfile/gfile_fs_fatfs.c @@ -14,7 +14,7 @@ #if GFX_USE_GFILE && GFILE_NEED_FATFS #include "gfile_fs.h" -#include "fatfs_wrapper.h" +#include "gfile_fatfs_wrapper.h" /******************************************************** * The FAT file-system VMT diff --git a/src/gfile/gfile_fs_petitfs.c b/src/gfile/gfile_fs_petitfs.c index 9b3b510b..443de42c 100644 --- a/src/gfile/gfile_fs_petitfs.c +++ b/src/gfile/gfile_fs_petitfs.c @@ -14,7 +14,7 @@ #if GFX_USE_GFILE && GFILE_NEED_PETITFS #include "gfile_fs.h" -#include "petitfs_wrapper.h" +#include "gfile_petitfs_wrapper.h" static bool_t petitfsExists(const char* fname); static bool_t petitfsOpen(GFILE* f, const char* fname); diff --git a/src/gfile/sys_options.h b/src/gfile/sys_options.h index 354d4f2b..5581b13b 100644 --- a/src/gfile/sys_options.h +++ b/src/gfile/sys_options.h @@ -127,7 +127,7 @@ * @note PETITFS can only have one file open at a time. */ #ifndef GFILE_NEED_PETITFS - #define GFILE_NEED_FATFS FALSE + #define GFILE_NEED_PETITFS FALSE #endif /** * @brief Include the operating system's native file system From 16fbcdc0b5b73024ab0f41b7d505f3265bf136f0 Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 17 Sep 2014 09:33:07 +1000 Subject: [PATCH 6/8] Convert GDRIVER instance numbers to unsigned. --- src/gdriver/gdriver_gdriver.c | 14 +++++++------- src/gdriver/sys_defs.h | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gdriver/gdriver_gdriver.c b/src/gdriver/gdriver_gdriver.c index 90a1d932..0a53aaf7 100644 --- a/src/gdriver/gdriver_gdriver.c +++ b/src/gdriver/gdriver_gdriver.c @@ -34,9 +34,9 @@ void _gdriverDeinit(void) { GDriver *gdriverRegister(const GDriverVMT *vmt) { - GDriver *pd; - GDriver *dtail; - int dinstance, sinstance; + GDriver * pd; + GDriver * dtail; + unsigned dinstance, sinstance; // Loop to find the driver instance and the system instance numbers dinstance = sinstance = 0; @@ -98,9 +98,9 @@ void gdriverUnRegister(GDriver *driver) { gfxFree(driver); } -GDriver *gdriverGetInstance(uint16_t type, int instance) { +GDriver *gdriverGetInstance(uint16_t type, unsigned instance) { GDriver *pd; - int sinstance; + unsigned sinstance; // Loop to find the system instance sinstance = 0; @@ -114,9 +114,9 @@ GDriver *gdriverGetInstance(uint16_t type, int instance) { return 0; } -int gdriverInstanceCount(uint16_t type) { +unsigned gdriverInstanceCount(uint16_t type) { GDriver *pd; - int sinstance; + unsigned sinstance; // Loop to count the system instances sinstance = 0; diff --git a/src/gdriver/sys_defs.h b/src/gdriver/sys_defs.h index 7f50fc6d..546246de 100644 --- a/src/gdriver/sys_defs.h +++ b/src/gdriver/sys_defs.h @@ -67,7 +67,7 @@ typedef struct GDriverVMT { uint16_t type; // @< What type of driver this is uint16_t flags; // @< Flags for the driver. Meaning is specific to each driver type. uint32_t objsize; // @< How big the runtime driver structure is - bool_t (*init)(GDriver *driver, int driverinstance, int systeminstance); // @< Initialise the driver. Returns TRUE if OK. + bool_t (*init)(GDriver *driver, unsigned driverinstance, unsigned systeminstance); // @< Initialise the driver. Returns TRUE if OK. // driverinstance is the instance 0..n of this driver. // systeminstance is the instance 0..n of this type of device. void (*postinit)(GDriver *driver); // @< Called once the driver is registered. @@ -118,7 +118,7 @@ extern "C" { * @param[in] type The type of driver to find * @param[in] instance The instance (0..n) to find */ - GDriver *gdriverGetInstance(uint16_t type, int instance); + GDriver *gdriverGetInstance(uint16_t type, unsigned instance); /** * @brief Get the count of instances of a type of device @@ -128,7 +128,7 @@ extern "C" { * * @param[in] type The type of driver to find */ - int gdriverInstanceCount(uint16_t type); + unsigned gdriverInstanceCount(uint16_t type); /** * @brief Get the next driver for a type of device From 3a520359a0bba575eff83e8013b705eacb93aeb4 Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 17 Sep 2014 09:34:08 +1000 Subject: [PATCH 7/8] GDISP updates to match previous GDRIVER and multiple display updates --- src/gdisp/driver.h | 4 ++-- src/gdisp/gdisp_gdisp.c | 15 ++++++++++++--- src/gdisp/sys_defs.h | 4 ++-- src/gdisp/sys_rules.h | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/gdisp/driver.h b/src/gdisp/driver.h index 288f9a65..f8d66f4b 100644 --- a/src/gdisp/driver.h +++ b/src/gdisp/driver.h @@ -287,7 +287,7 @@ struct GDisplay { }; typedef struct GDISPVMT { - GDriverVMT vmtdriver; + GDriverVMT d; bool_t (*init)(GDisplay *g); void (*deinit)(GDisplay *g); void (*writestart)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy @@ -617,7 +617,7 @@ typedef struct GDISPVMT { #endif // Routines needed by the general driver VMT - bool_t _gdispInitDriver(GDriver *g, int driverinstance, int systeminstance); + bool_t _gdispInitDriver(GDriver *g, unsigned driverinstance, unsigned systeminstance); void _gdispPostInitDriver(GDriver *g); void _gdispDeInitDriver(GDriver *g); diff --git a/src/gdisp/gdisp_gdisp.c b/src/gdisp/gdisp_gdisp.c index 0e5cacb5..4a149faa 100644 --- a/src/gdisp/gdisp_gdisp.c +++ b/src/gdisp/gdisp_gdisp.c @@ -569,7 +569,7 @@ void _gdispInit(void) // GDISP_DRIVER_LIST is defined - create each driver instance #if defined(GDISP_DRIVER_LIST) { - int i; + unsigned i; extern GDriverVMTList GDISP_DRIVER_LIST; static const struct GDriverVMT const * dclist[] = {GDISP_DRIVER_LIST}; @@ -579,7 +579,8 @@ void _gdispInit(void) } #elif GDISP_TOTAL_DISPLAYS > 1 { - int i; + unsigned i; + extern GDriverVMTList GDISPVMT_OnlyOne; for(i = 0; i < GDISP_TOTAL_DISPLAYS; i++) gdriverRegister(GDISPVMT_OnlyOne); @@ -622,7 +623,7 @@ void _gdispDeinit(void) /* ToDo */ } -bool_t _gdispInitDriver(GDriver *g, int driverinstance, int systeminstance) { +bool_t _gdispInitDriver(GDriver *g, unsigned driverinstance, unsigned systeminstance) { #define gd ((GDisplay *)g) bool_t ret; @@ -694,10 +695,18 @@ void _gdispDeInitDriver(GDriver *g) { #undef gd } +GDisplay *gdispGetDisplay(unsigned display) { + return (GDisplay *)gdriverGetInstance(GDRIVER_TYPE_DISPLAY, display); +} + void gdispSetDisplay(GDisplay *g) { if (g) GDISP = g; } +unsigned gdispGetDisplayCount(void) { + return gdriverInstanceCount(GDRIVER_TYPE_DISPLAY); +} + coord_t gdispGGetWidth(GDisplay *g) { return g->g.Width; } coord_t gdispGGetHeight(GDisplay *g) { return g->g.Height; } powermode_t gdispGGetPowerMode(GDisplay *g) { return g->g.Powermode; } diff --git a/src/gdisp/sys_defs.h b/src/gdisp/sys_defs.h index 0d51d639..35844e2d 100644 --- a/src/gdisp/sys_defs.h +++ b/src/gdisp/sys_defs.h @@ -219,7 +219,7 @@ color_t gdispContrastColor(color_t color); * * @api */ -#define gdispGetDisplay(display) ((GDisplay *)gdriverGetInstance(GDRIVER_TYPE_DISPLAY, display)) +GDisplay *gdispGetDisplay(unsigned display); /** * @brief Set the current default display to the specified display @@ -241,7 +241,7 @@ void gdispSetDisplay(GDisplay *g); * * @note Displays are numbered from 0 to @p gdispGetDisplayCount() - 1 */ -#define gdispGetDisplayCount() gdriverInstanceCount(GDRIVER_TYPE_DISPLAY) +unsigned gdispGetDisplayCount(void); /* Property Functions */ diff --git a/src/gdisp/sys_rules.h b/src/gdisp/sys_rules.h index 90b07138..79df2d88 100644 --- a/src/gdisp/sys_rules.h +++ b/src/gdisp/sys_rules.h @@ -26,7 +26,7 @@ #endif #if defined(GDISP_DRIVER_LIST) #if GDISP_TOTAL_DISPLAYS != 1 - #error "GDISP Multiple Drivers: You can't specify both GDISP_TOTAL_DISPLAYS and GDISP_DRIVER_LIST + #error "GDISP Multiple Drivers: You can't specify both GDISP_TOTAL_DISPLAYS and GDISP_DRIVER_LIST" #endif #ifndef GDISP_PIXELFORMAT #error "GDISP Multiple Drivers: You must specify a value for GDISP_PIXELFORMAT when using GDISP_DRIVER_LIST" From 6e265c80d2f9a197b5b1573ffb972c8827162728 Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 17 Sep 2014 09:34:24 +1000 Subject: [PATCH 8/8] Remove compile warning. --- drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c b/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c index e96ad3b2..82c0e2ff 100644 --- a/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c +++ b/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c @@ -161,7 +161,6 @@ static DECLARE_THREAD_FUNCTION(NetThread, param) { SOCKET_TYPE listenfd, fdmax, i, clientfd; socklen_t len; int leni; - unsigned disp; fd_set master, read_fds; struct sockaddr_in addr; GDisplay * g;