aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndrew Hannam <andrewh@inmarket.com.au>2012-12-06 18:45:54 +1000
committerAndrew Hannam <andrewh@inmarket.com.au>2012-12-06 18:45:54 +1000
commit07f34835358ef65de310934ae726b66c7ca46f68 (patch)
tree6b6875cc38f19bc1dd41b3b7edc8ea10ab7dbc84 /include
parente236a0a6b79ccd4446df72256740913392cf12f7 (diff)
downloaduGFX-07f34835358ef65de310934ae726b66c7ca46f68.tar.gz
uGFX-07f34835358ef65de310934ae726b66c7ca46f68.tar.bz2
uGFX-07f34835358ef65de310934ae726b66c7ca46f68.zip
Restructure
Create global include file called gfx.h which knows about sub-system dependancies. Deprecate Touchscreen (GINPUT touch is now working properly) Merge Graph into GWIN Change directory structure to reflect sub-system structure Many small bugs fixed Split Nokia6610 gdisp driver into GE8 and GE12 controller versions Fixed broken demos. GFX sub-systems are now clearly defined and new ones should be much easier to add.
Diffstat (limited to 'include')
-rw-r--r--include/gdisp/gdisp.h (renamed from include/gdisp.h)71
-rw-r--r--include/gdisp/lld/emulation.c (renamed from include/lld/gdisp/emulation.c)4
-rw-r--r--include/gdisp/lld/gdisp_lld.h (renamed from include/lld/gdisp/gdisp_lld.h)108
-rw-r--r--include/gdisp/lld/gdisp_lld_msgs.h (renamed from include/lld/gdisp/gdisp_lld_msgs.h)6
-rw-r--r--include/gdisp/options.h208
-rw-r--r--include/gevent/gevent.h (renamed from include/gevent.h)60
-rw-r--r--include/gevent/options.h68
-rw-r--r--include/gfx.h114
-rw-r--r--include/gfx_rules.h113
-rw-r--r--include/gfxconf.example.h74
-rw-r--r--include/ginput.h98
-rw-r--r--include/ginput/dial.h (renamed from include/ginput/ginput_dial.h)19
-rw-r--r--include/ginput/ginput.h55
-rw-r--r--include/ginput/keyboard.h (renamed from include/ginput/ginput_keyboard.h)19
-rw-r--r--include/ginput/lld/mouse.h (renamed from include/lld/ginput/mouse.h)11
-rw-r--r--include/ginput/lld/toggle.h (renamed from include/lld/ginput/toggle.h)19
-rw-r--r--include/ginput/mouse.h (renamed from include/ginput/ginput_mouse.h)17
-rw-r--r--include/ginput/options.h127
-rw-r--r--include/ginput/toggle.h (renamed from include/ginput/ginput_toggle.h)21
-rw-r--r--include/graph.h84
-rw-r--r--include/gtimer/gtimer.h (renamed from include/gtimer.h)47
-rw-r--r--include/gtimer/options.h52
-rw-r--r--include/gwin/button.h (renamed from include/gwin/gwin_button.h)34
-rw-r--r--include/gwin/console.h (renamed from include/gwin/gwin_console.h)27
-rw-r--r--include/gwin/graph.h156
-rw-r--r--include/gwin/gwin.h (renamed from include/gwin.h)40
-rw-r--r--include/gwin/internal.h53
-rw-r--r--include/gwin/options.h71
-rw-r--r--include/lld/touchscreen/touchscreen_lld.h130
-rw-r--r--include/touchscreen.h93
30 files changed, 1154 insertions, 845 deletions
diff --git a/include/gdisp.h b/include/gdisp/gdisp.h
index 53848e16..b9434d3f 100644
--- a/include/gdisp.h
+++ b/include/gdisp/gdisp.h
@@ -19,7 +19,7 @@
*/
/**
- * @file include/gdisp.h
+ * @file include/gdisp/gdisp.h
* @brief GDISP Graphic Driver subsystem header file.
*
* @addtogroup GDISP
@@ -29,9 +29,16 @@
#ifndef _GDISP_H
#define _GDISP_H
-#ifndef GFX_USE_GDISP
- #define GFX_USE_GDISP FALSE
-#endif
+#include "gfx.h"
+
+/* This type definition is defined here as it gets used in other gfx sub-systems even
+ * if GFX_USE_GDISP is FALSE.
+ */
+
+/**
+ * @brief The type for a coordinate or length on the screen.
+ */
+typedef int16_t coord_t;
#if GFX_USE_GDISP || defined(__DOXYGEN__)
@@ -66,65 +73,16 @@
#define SkyBlue HTML2COLOR(0x87CEEB)
/*===========================================================================*/
-/* Driver pre-compile time settings. */
-/*===========================================================================*/
-
-/**
- * @name GDISP more complex functionality to be compiled
- * @{
- */
- /**
- * @brief Do the drawing functions need to be thread-safe.
- * @details Defaults to FALSE
- * @note Both GDISP_NEED_MULTITHREAD and GDISP_NEED_ASYNC make
- * the gdisp API thread-safe.
- * @note This is more efficient than GDISP_NEED_ASYNC as it only
- * requires a context switch if something else is already
- * drawing.
- */
- #ifndef GDISP_NEED_MULTITHREAD
- #define GDISP_NEED_MULTITHREAD FALSE
- #endif
-
- /**
- * @brief Use asynchronous calls (multi-thread safe).
- * @details Defaults to FALSE
- * @note Both GDISP_NEED_MULTITHREAD and GDISP_NEED_ASYNC make
- * the gdisp API thread-safe.
- * @note Turning this on adds two context switches per transaction
- * so it can significantly slow graphics drawing.
- */
- #ifndef GDISP_NEED_ASYNC
- #define GDISP_NEED_ASYNC FALSE
- #endif
-/** @} */
-
-#if GDISP_NEED_MULTITHREAD && GDISP_NEED_ASYNC
- #error "GDISP: Only one of GDISP_NEED_MULTITHREAD and GDISP_NEED_ASYNC should be defined."
-#endif
-
-#if GDISP_NEED_ASYNC
- /* Messaging API is required for Async Multi-Thread */
- #undef GDISP_NEED_MSGAPI
- #define GDISP_NEED_MSGAPI TRUE
-#endif
-
-/*===========================================================================*/
/* Low Level Driver details and error checks. */
/*===========================================================================*/
/* Include the low level driver information */
-#include "lld/gdisp/gdisp_lld.h"
+#include "gdisp/lld/gdisp_lld.h"
/*===========================================================================*/
/* Type definitions */
/*===========================================================================*/
-typedef struct _point_t {
- coord_t x;
- coord_t y;
-} point_t;
-
/**
* @brief Type for the text justification.
*/
@@ -224,9 +182,7 @@ extern "C" {
#endif
/* Query driver specific data */
- #if GDISP_NEED_CONTROL
void *gdispQuery(unsigned what);
- #endif
#else
@@ -286,8 +242,9 @@ void gdispDrawBox(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color);
/*
* Macro definitions
*/
+
/* Now obsolete functions */
-#define gdispBlitArea(x, y, cx, cy, buffer) gdispBlitAreaEx(x, y, cx, cy, 0, 0, cx, buffer)
+#define gdispBlitArea(x, y, cx, cy, buffer) gdispBlitAreaEx(x, y, cx, cy, 0, 0, cx, buffer)
/* Macro definitions for common gets and sets */
#define gdispSetPowerMode(powerMode) gdispControl(GDISP_CONTROL_POWER, (void *)(unsigned)(powerMode))
diff --git a/include/lld/gdisp/emulation.c b/include/gdisp/lld/emulation.c
index 88a8c42f..04afd630 100644
--- a/include/lld/gdisp/emulation.c
+++ b/include/gdisp/lld/emulation.c
@@ -667,7 +667,7 @@
}
#endif
-#if GDISP_NEED_QUERY && !GDISP_HARDWARE_QUERY
+#if !GDISP_HARDWARE_QUERY
void *GDISP_LLD(query)(unsigned what) {
switch(what) {
case GDISP_QUERY_WIDTH: return (void *)(unsigned)GDISP.Width;
@@ -756,11 +756,9 @@ void *GDISP_LLD(query)(unsigned what) {
GDISP_LLD(control)(msg->control.what, msg->control.value);
break;
#endif
- #if GDISP_NEED_QUERY
case GDISP_LLD_MSG_QUERY:
msg->query.result = GDISP_LLD(query)(msg->query.what);
break;
- #endif
}
}
#endif
diff --git a/include/lld/gdisp/gdisp_lld.h b/include/gdisp/lld/gdisp_lld.h
index 4e29dc48..76b698bc 100644
--- a/include/lld/gdisp/gdisp_lld.h
+++ b/include/gdisp/lld/gdisp_lld.h
@@ -19,7 +19,7 @@
*/
/**
- * @file include/lld/gdisp/gdisp_lld.h
+ * @file include/gdisp/lld/gdisp_lld.h
* @brief GDISP Graphic Driver subsystem low level driver header.
*
* @addtogroup GDISP
@@ -35,106 +35,6 @@
/* Low level driver configuration needs */
/*===========================================================================*/
-/**
- * @name GDISP low level driver more complex functionality to be compiled
- * @{
- */
- /**
- * @brief Should all operations be clipped to the screen and colors validated.
- * @details Defaults to TRUE.
- * @note If this is FALSE, any operations that extend beyond the
- * edge of the screen will have undefined results. Any
- * out-of-range colors will produce undefined results.
- * @note If defined then all low level and high level driver routines
- * must check the validity of inputs and do something sensible
- * if they are out of range. It doesn't have to be efficient,
- * just valid.
- */
- #ifndef GDISP_NEED_VALIDATION
- #define GDISP_NEED_VALIDATION TRUE
- #endif
-
- /**
- * @brief Are circle functions needed.
- * @details Defaults to TRUE
- */
- #ifndef GDISP_NEED_CIRCLE
- #define GDISP_NEED_CIRCLE TRUE
- #endif
-
- /**
- * @brief Are ellipse functions needed.
- * @details Defaults to TRUE
- */
- #ifndef GDISP_NEED_ELLIPSE
- #define GDISP_NEED_ELLIPSE TRUE
- #endif
-
- /**
- * @brief Are arc functions needed.
- * @details Defaults to FALSE
- */
- #ifndef GDISP_NEED_ARC
- #define GDISP_NEED_ARC FALSE
- #endif
-
- /**
- * @brief Are text functions needed.
- * @details Defaults to TRUE
- */
- #ifndef GDISP_NEED_TEXT
- #define GDISP_NEED_TEXT TRUE
- #endif
-
- /**
- * @brief Is scrolling needed.
- * @details Defaults to FALSE
- */
- #ifndef GDISP_NEED_SCROLL
- #define GDISP_NEED_SCROLL FALSE
- #endif
-
- /**
- * @brief Is the capability to read pixels back needed.
- * @details Defaults to FALSE
- */
- #ifndef GDISP_NEED_PIXELREAD
- #define GDISP_NEED_PIXELREAD FALSE
- #endif
-
- /**
- * @brief Are clipping functions needed.
- * @details Defaults to TRUE
- */
- #ifndef GDISP_NEED_CLIP
- #define GDISP_NEED_CLIP FALSE
- #endif
-
- /**
- * @brief Control some aspect of the drivers operation.
- * @details Defaults to FALSE
- */
- #ifndef GDISP_NEED_CONTROL
- #define GDISP_NEED_CONTROL FALSE
- #endif
-
- /**
- * @brief Query some aspect of the drivers operation.
- * @details Defaults to TRUE
- */
- #ifndef GDISP_NEED_QUERY
- #define GDISP_NEED_QUERY TRUE
- #endif
-
- /**
- * @brief Is the messaging api interface required.
- * @details Defaults to FALSE
- */
- #ifndef GDISP_NEED_MSGAPI
- #define GDISP_NEED_MSGAPI FALSE
- #endif
-/** @} */
-
/*===========================================================================*/
/* Include the low level driver configuration information */
/*===========================================================================*/
@@ -538,10 +438,6 @@
/*===========================================================================*/
/**
- * @brief The type for a coordinate or length on the screen.
- */
-typedef int16_t coord_t;
-/**
* @brief The type of a pixel.
*/
typedef color_t pixel_t;
@@ -624,9 +520,7 @@ extern "C" {
#endif
/* Query driver specific data */
- #if GDISP_NEED_QUERY
extern void *GDISP_LLD_VMT(query)(unsigned what);
- #endif
/* Clipping Functions */
#if GDISP_NEED_CLIP
diff --git a/include/lld/gdisp/gdisp_lld_msgs.h b/include/gdisp/lld/gdisp_lld_msgs.h
index f5d29ea1..31a82237 100644
--- a/include/lld/gdisp/gdisp_lld_msgs.h
+++ b/include/gdisp/lld/gdisp_lld_msgs.h
@@ -68,9 +68,7 @@ typedef enum gdisp_msgaction {
#if GDISP_NEED_CONTROL
GDISP_LLD_MSG_CONTROL,
#endif
- #if GDISP_NEED_QUERY
- GDISP_LLD_MSG_QUERY,
- #endif
+ GDISP_LLD_MSG_QUERY,
} gdisp_msgaction_t;
typedef union gdisp_lld_msg {
@@ -189,7 +187,7 @@ typedef union gdisp_lld_msg {
} query;
} gdisp_lld_msg_t;
-#endif /* GFX_USE_GDISP */
+#endif /* GFX_USE_GDISP && GDISP_NEED_MSGAPI */
#endif /* _GDISP_LLD_MSGS_H */
/** @} */
diff --git a/include/gdisp/options.h b/include/gdisp/options.h
new file mode 100644
index 00000000..c2163631
--- /dev/null
+++ b/include/gdisp/options.h
@@ -0,0 +1,208 @@
+/*
+ ChibiOS/GFX - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS/GFX.
+
+ ChibiOS/GFX is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/GFX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file include/gdisp/options.h
+ * @brief GDISP sub-system options header file.
+ *
+ * @addtogroup GDISP
+ * @{
+ */
+
+#ifndef _GDISP_OPTIONS_H
+#define _GDISP_OPTIONS_H
+
+/**
+ * @name GDISP Functionality to be included
+ * @{
+ */
+ /**
+ * @brief Should all operations be clipped to the screen and colors validated.
+ * @details Defaults to TRUE.
+ * @note If this is FALSE, any operations that extend beyond the
+ * edge of the screen will have undefined results. Any
+ * out-of-range colors will produce undefined results.
+ * @note If defined then all low level and high level GDISP driver routines
+ * must check the validity of inputs and do something sensible
+ * if they are out of range. It doesn't have to be efficient,
+ * just valid.
+ */
+ #ifndef GDISP_NEED_VALIDATION
+ #define GDISP_NEED_VALIDATION TRUE
+ #endif
+ /**
+ * @brief Are clipping functions needed.
+ * @details Defaults to TRUE
+ */
+ #ifndef GDISP_NEED_CLIP
+ #define GDISP_NEED_CLIP TRUE
+ #endif
+ /**
+ * @brief Are text functions needed.
+ * @details Defaults to TRUE
+ */
+ #ifndef GDISP_NEED_TEXT
+ #define GDISP_NEED_TEXT TRUE
+ #endif
+ /**
+ * @brief Are circle functions needed.
+ * @details Defaults to TRUE
+ */
+ #ifndef GDISP_NEED_CIRCLE
+ #define GDISP_NEED_CIRCLE TRUE
+ #endif
+ /**
+ * @brief Are ellipse functions needed.
+ * @details Defaults to TRUE
+ */
+ #ifndef GDISP_NEED_ELLIPSE
+ #define GDISP_NEED_ELLIPSE TRUE
+ #endif
+ /**
+ * @brief Are arc functions needed.
+ * @details Defaults to FALSE
+ * @note Requires the maths library to be included in the link. ie -lm
+ */
+ #ifndef GDISP_NEED_ARC
+ #define GDISP_NEED_ARC FALSE
+ #endif
+ /**
+ * @brief Are scrolling functions needed.
+ * @details Defaults to FALSE
+ * @note This function must be supported by the low level GDISP driver
+ * you have included in your project. If it isn't, defining this
+ * option will cause a compile error.
+ */
+ #ifndef GDISP_NEED_SCROLL
+ #define GDISP_NEED_SCROLL FALSE
+ #endif
+ /**
+ * @brief Is the capability to read pixels back needed.
+ * @details Defaults to FALSE
+ * @note This function must be supported by the low level GDISP driver
+ * you have included in your project. If it isn't, defining this
+ * option will cause a compile error.
+ */
+ #ifndef GDISP_NEED_PIXELREAD
+ #define GDISP_NEED_PIXELREAD FALSE
+ #endif
+ /**
+ * @brief Control some aspect of the hardware operation.
+ * @details Defaults to FALSE
+ * @note This allows control of hardware specific features such as
+ * screen rotation, backlight levels, contrast etc
+ */
+ #ifndef GDISP_NEED_CONTROL
+ #define GDISP_NEED_CONTROL FALSE
+ #endif
+ /**
+ * @brief Is the messaging api interface required.
+ * @details Defaults to FALSE
+ */
+ #ifndef GDISP_NEED_MSGAPI
+ #define GDISP_NEED_MSGAPI FALSE
+ #endif
+/**
+ * @}
+ *
+ * @name GDISP Multi-Threading Options
+ * @{
+ */
+ /**
+ * @brief Do the drawing functions need to be thread-safe.
+ * @details Defaults to FALSE
+ * @note Both GDISP_NEED_MULTITHREAD and GDISP_NEED_ASYNC make
+ * the gdisp API thread-safe.
+ * @note This is more efficient than GDISP_NEED_ASYNC as it only
+ * requires a context switch if something else is already
+ * drawing.
+ */
+ #ifndef GDISP_NEED_MULTITHREAD
+ #define GDISP_NEED_MULTITHREAD FALSE
+ #endif
+ /**
+ * @brief Use asynchronous calls (multi-thread safe).
+ * @details Defaults to FALSE
+ * @note Both GDISP_NEED_MULTITHREAD and GDISP_NEED_ASYNC make
+ * the gdisp API thread-safe.
+ * @note Turning this on adds two context switches per transaction
+ * so it can significantly slow graphics drawing but it allows
+ * drawing operations to continue in the background.
+ */
+ #ifndef GDISP_NEED_ASYNC
+ #define GDISP_NEED_ASYNC FALSE
+ #endif
+/**
+ * @}
+ *
+ * @name GDISP Optional Sizing Parameters
+ * @{
+ */
+ /**
+ * @brief The maximum height of a font.
+ * @details Either 16 or 32. Defaults to 16
+ * @note Setting this to 32 causes the font tables to take
+ * twice the internal program memory. Don't do it unless
+ * you realy must define an unscaled font larger than 16 bits high.
+ */
+ #ifndef GDISP_MAX_FONT_HEIGHT
+ #define GDISP_MAX_FONT_HEIGHT 16
+ #endif
+/**
+ * @}
+ *
+ * @name GDISP Optional Low Level Driver Defines
+ * @{
+ */
+ /**
+ * @brief Use a custom board definition even if a board definition exists.
+ * @details Defaults to FALSE
+ * @details If TRUE, add gdisp_lld_board.h to your project directory and customise it.
+ * @note Not all GDISP low level drivers currently use board definition files.
+ */
+ #ifndef GDISP_USE_CUSTOM_BOARD
+ #define GDISP_USE_CUSTOM_BOARD FALSE
+ #endif
+ /**
+ * @brief Set the screen height and width.
+ * @note Ignored by some low level GDISP drivers, optional for others.
+ * @note Where these values are allowed, a default is always provided be the low level driver.
+ * @note The list of GDISP low level drivers that allow these to be set are...
+ * WIN32, SSD1289, SSD1963, TestStub
+ */
+ /* #define GDISP_SCREEN_WIDTH nnnn */
+ /* #define GDISP_SCREEN_HEIGHT nnnn */
+ /**
+ * @brief Define which bus interface to use.
+ * @details Only required by the SSD1963 driver.
+ * @note This will be replaced eventually by board definition files
+ */
+ /* #define GDISP_USE_FSMC */
+ /* #define GDISP_USE_GPIO */
+ /**
+ * @brief Define which two drivers will be used by the VMT layer.
+ * @details Only required by the VMT driver.
+ */
+ /* #define GDISP_VMT_NAME1(x) x##YourDriver1 */
+ /* #define GDISP_VMT_NAME2(x) x##YourDriver2 */
+/** @} */
+
+#endif /* _GDISP_OPTIONS_H */
+/** @} */
diff --git a/include/gevent.h b/include/gevent/gevent.h
index 6467e60d..a68a5fc0 100644
--- a/include/gevent.h
+++ b/include/gevent/gevent.h
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * @file gevent.h
+ * @file include/gevent/gevent.h
* @brief GEVENT GFX User Event subsystem header file.
*
* @addtogroup GEVENT
@@ -27,56 +27,18 @@
#ifndef _GEVENT_H
#define _GEVENT_H
-#ifndef GFX_USE_GEVENT
- #define GFX_USE_GEVENT FALSE
-#endif
+#include "gfx.h"
#if GFX_USE_GEVENT || defined(__DOXYGEN__)
/**
- * @name GEVENT macros and more complex functionality to be compiled
- * @{
+ * @brief Data part of a static GListener initializer.
*/
- /**
- * @brief Data part of a static GListener initializer.
- */
- #define _GLISTENER_DATA(name) { _SEMAPHORE_DATA(name.waitqueue, 0), _BSEMAPHORE_DATA(name.eventlock, FALSE), 0, 0, {0} }
- /**
- * @brief Static GListener initializer.
- */
- #define GLISTENER_DECL(name) GListener name = _GLISTENER_DATA(name)
- /**
- * @brief Defines the maximum size of an event status variable.
- * @details Defaults to 32 bytes
- */
- #ifndef GEVENT_MAXIMUM_STATUS_SIZE
- #define GEVENT_MAXIMUM_STATUS_SIZE 32
- #endif
- /**
- * @brief Should routines assert() if they run out of resources.
- * @details Defaults to FALSE.
- * @details If FALSE the application must be prepared to handle these
- * failures.
- */
- #ifndef GEVENT_ASSERT_NO_RESOURCE
- #define GEVENT_ASSERT_NO_RESOURCE FALSE
- #endif
- /**
- * @brief Defines the maximum Source/Listener pairs in the system.
- * @details Defaults to 32
- */
- #ifndef MAX_SOURCE_LISTENERS
- #define MAX_SOURCE_LISTENERS 32
- #endif
-/** @} */
-
-/*===========================================================================*/
-/* Low Level Driver details and error checks. */
-/*===========================================================================*/
-
-#if !CH_USE_MUTEXES || !CH_USE_SEMAPHORES
- #error "GEVENT: CH_USE_MUTEXES and CH_USE_SEMAPHORES must be defined in chconf.h"
-#endif
+#define _GLISTENER_DATA(name) { _SEMAPHORE_DATA(name.waitqueue, 0), _BSEMAPHORE_DATA(name.eventlock, FALSE), 0, 0, {0} }
+/**
+ * @brief Static GListener initializer.
+ */
+#define GLISTENER_DECL(name) GListener name = _GLISTENER_DATA(name)
/*===========================================================================*/
/* Type definitions */
@@ -93,11 +55,11 @@ typedef uint16_t GEventType;
// This object can be typecast to any GEventXxxxx type to allow any sub-system (or the application) to create events.
// The prerequisite is that the new status structure type starts with a field named 'type' of type 'GEventType'.
-// The total status structure also must not exceed GEVENT_MAXIMUM_STATUS_SIZE bytes.
+// The total status structure also must not exceed GEVENT_MAXIMUM_SIZE bytes.
// For example, this is used by GWIN button events, GINPUT data streams etc.
typedef union GEvent_u {
- GEventType type; // The type of this event
- char pad[GEVENT_MAXIMUM_STATUS_SIZE]; // This is here to allow static initialisation of GEventObject's in the application.
+ GEventType type; // The type of this event
+ char pad[GEVENT_MAXIMUM_SIZE]; // This is here to allow static initialisation of GEventObject's in the application.
} GEvent;
// A special callback function
diff --git a/include/gevent/options.h b/include/gevent/options.h
new file mode 100644
index 00000000..576233bf
--- /dev/null
+++ b/include/gevent/options.h
@@ -0,0 +1,68 @@
+/*
+ ChibiOS/GFX - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS/GFX.
+
+ ChibiOS/GFX is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/GFX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file include/gevent/options.h
+ * @brief GEVENT sub-system options header file.
+ *
+ * @addtogroup GEVENT
+ * @{
+ */
+
+#ifndef _GEVENT_OPTIONS_H
+#define _GEVENT_OPTIONS_H
+
+/**
+ * @name GEVENT Functionality to be included
+ * @{
+ */
+ /**
+ * @brief Should routines assert() if they run out of resources.
+ * @details Defaults to FALSE.
+ * @details If FALSE the application must be prepared to handle these
+ * failures.
+ */
+ #ifndef GEVENT_ASSERT_NO_RESOURCE
+ #define GEVENT_ASSERT_NO_RESOURCE FALSE
+ #endif
+/**
+ * @}
+ *
+ * @name GEVENT Optional Sizing Parameters
+ * @{
+ */
+ /**
+ * @brief Defines the maximum size of an event status variable.
+ * @details Defaults to 32 bytes
+ */
+ #ifndef GEVENT_MAXIMUM_SIZE
+ #define GEVENT_MAXIMUM_SIZE 32
+ #endif
+ /**
+ * @brief Defines the maximum Source/Listener pairs in the system.
+ * @details Defaults to 32
+ */
+ #ifndef GEVENT_MAX_SOURCE_LISTENERS
+ #define GEVENT_MAX_SOURCE_LISTENERS 32
+ #endif
+/** @} */
+
+#endif /* _GEVENT_OPTIONS_H */
+/** @} */
diff --git a/include/gfx.h b/include/gfx.h
new file mode 100644
index 00000000..9dfe681a
--- /dev/null
+++ b/include/gfx.h
@@ -0,0 +1,114 @@
+/*
+ ChibiOS/GFX - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS/GFX.
+
+ ChibiOS/GFX is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/GFX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file include/gfx.h
+ * @brief GFX system header file.
+ *
+ * @addtogroup GFX
+ * @{
+ */
+
+#ifndef _GFX_H
+#define _GFX_H
+
+/* gfxconf.h is the user's project configuration for the GFX system. */
+#include "gfxconf.h"
+
+/**
+ * @name GFX sub-systems that can be turned on
+ * @{
+ */
+ /**
+ * @brief GFX Graphics Display Basic API
+ * @details Defaults to FALSE
+ * @note Also add the specific hardware driver to your makefile.
+ * Eg. include $(GFXLIB)/drivers/gdisp/Nokia6610/gdisp_lld.mk
+ */
+ #ifndef GFX_USE_GDISP
+ #define GFX_USE_GDISP FALSE
+ #endif
+ /**
+ * @brief GFX Graphics Windowing API
+ * @details Defaults to FALSE
+ * @details Extends the GDISP API to add the concept of graphic windows.
+ * @note Also supports high-level "window" objects such as console windows,
+ * buttons, graphing etc
+ */
+ #ifndef GFX_USE_GWIN
+ #define GFX_USE_GWIN FALSE
+ #endif
+ /**
+ * @brief GFX Event API
+ * @details Defaults to FALSE
+ * @details Defines the concept of a "Source" that can send "Events" to "Listeners".
+ */
+ #ifndef GFX_USE_GEVENT
+ #define GFX_USE_GEVENT FALSE
+ #endif
+ /**
+ * @brief GFX Timer API
+ * @details Defaults to FALSE
+ * @details Provides thread context timers - both one-shot and periodic.
+ */
+ #ifndef GFX_USE_GTIMER
+ #define GFX_USE_GTIMER FALSE
+ #endif
+ /**
+ * @brief GFX Input Device API
+ * @details Defaults to FALSE
+ * @note Also add the specific hardware drivers to your makefile.
+ * Eg.
+ * include $(GFXLIB)/drivers/ginput/toggle/Pal/ginput_lld.mk
+ * and...
+ * include $(GFXLIB)/drivers/ginput/touch/MCU/ginput_lld.mk
+ */
+ #ifndef GFX_USE_GINPUT
+ #define GFX_USE_GINPUT FALSE
+ #endif
+/** @} */
+
+/**
+ * Get all the options for each sub-system.
+ *
+ */
+#include "gevent/options.h"
+#include "gtimer/options.h"
+#include "gdisp/options.h"
+#include "gwin/options.h"
+#include "ginput/options.h"
+
+/**
+ * Inter-dependancy safety checks on the sub-systems.
+ *
+ */
+#include "gfx_rules.h"
+
+/**
+ * Include the sub-system header files
+ */
+#include "gevent/gevent.h"
+#include "gtimer/gtimer.h"
+#include "gdisp/gdisp.h"
+#include "gwin/gwin.h"
+#include "ginput/ginput.h"
+
+#endif /* _GFX_H */
+/** @} */
diff --git a/include/gfx_rules.h b/include/gfx_rules.h
new file mode 100644
index 00000000..26c9429c
--- /dev/null
+++ b/include/gfx_rules.h
@@ -0,0 +1,113 @@
+/*
+ ChibiOS/GFX - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS/GFX.
+
+ ChibiOS/GFX is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/GFX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file include/gfx_rules.h
+ * @brief GFX system safety rules header file.
+ *
+ * @addtogroup GFX
+ * @{
+ */
+
+#ifndef _GFX_RULES_H
+#define _GFX_RULES_H
+
+/**
+ * Safety checks on all the defines.
+ *
+ * These are defined in the order of their inter-dependancies.
+ */
+
+#if GFX_USE_GWIN
+ #if !GFX_USE_GDISP
+ #error "GWIN: GFX_USE_GDISP must be TRUE when using GWIN"
+ #endif
+ #if !GDISP_NEED_CLIP
+ #warning "GWIN: Drawing can occur outside the defined windows as GDISP_NEED_CLIP is FALSE"
+ #endif
+ #if GWIN_NEED_BUTTON
+ #if !GDISP_NEED_TEXT
+ #error "GWIN: GDISP_NEED_TEXT is required if GWIN_NEED_BUTTON is TRUE."
+ #endif
+ #if !GFX_USE_GEVENT
+ #warning "GWIN: GFX_USE_GEVENT is required if GWIN_NEED_BUTTON is TRUE. It has been turned on for you."
+ #undef GFX_USE_GEVENT
+ #define GFX_USE_GEVENT TRUE
+ #endif
+ #if !GFX_USE_GINPUT || !(GINPUT_NEED_MOUSE || GINPUT_NEED_TOGGLE)
+ #warning "GWIN: You have set GWIN_NEED_BUTTON to TRUE but no supported GINPUT (mouse/toggle) devices have been included"
+ #endif
+ #if !GDISP_NEED_MULTITHREAD && !GDISP_NEED_ASYNC
+ #warning "GWIN: Either GDISP_NEED_MULTITHREAD or GDISP_NEED_ASYNC is required if GWIN_NEED_BUTTON is TRUE."
+ #warning "GWIN: GDISP_NEED_MULTITHREAD has been turned on for you."
+ #undef GDISP_NEED_MULTITHREAD
+ #define GDISP_NEED_MULTITHREAD TRUE
+ #endif
+ #endif
+ #if GWIN_NEED_CONSOLE
+ #if !GDISP_NEED_TEXT
+ #error "GWIN: GDISP_NEED_TEXT is required if GWIN_NEED_CONSOLE is TRUE."
+ #endif
+ #endif
+ #if GWIN_NEED_GRAPH
+ #endif
+#endif
+
+#if GFX_USE_GINPUT
+ #if !GFX_USE_GEVENT
+ #warning "GINPUT: GFX_USE_GEVENT is required if GFX_USE_GINPUT is TRUE. It has been turned on for you."
+ #undef GFX_USE_GEVENT
+ #define GFX_USE_GEVENT TRUE
+ #endif
+ #if !GFX_USE_GTIMER
+ #warning "GINPUT: GFX_USE_GTIMER is required if GFX_USE_GINPUT is TRUE. It has been turned on for you."
+ #undef GFX_USE_GTIMER
+ #define GFX_USE_GTIMER TRUE
+ #endif
+#endif
+
+#if GFX_USE_GDISP
+ #if GDISP_NEED_MULTITHREAD && GDISP_NEED_ASYNC
+ #error "GDISP: Only one of GDISP_NEED_MULTITHREAD and GDISP_NEED_ASYNC should be defined."
+ #endif
+ #if GDISP_NEED_ASYNC
+ #if !GDISP_NEED_MSGAPI
+ #warning "GDISP: Messaging API is required for Async Multi-Thread. It has been turned on for you."
+ #undef GDISP_NEED_MSGAPI
+ #define GDISP_NEED_MSGAPI TRUE
+ #endif
+ #endif
+#endif
+
+#if GFX_USE_GEVENT
+ #if !CH_USE_MUTEXES || !CH_USE_SEMAPHORES
+ #error "GEVENT: CH_USE_MUTEXES and CH_USE_SEMAPHORES must be defined in chconf.h"
+ #endif
+#endif
+
+#if GFX_USE_GTIMER
+ #if GFX_USE_GDISP && !GDISP_NEED_MULTITHREAD && !GDISP_NEED_ASYNC
+ #warning "GTIMER: Neither GDISP_NEED_MULTITHREAD nor GDISP_NEED_ASYNC has been specified."
+ #warning "GTIMER: Make sure you are not performing any GDISP/GWIN drawing operations in the timer callback!"
+ #endif
+#endif
+
+#endif /* _GFX_H */
+/** @} */
diff --git a/include/gfxconf.example.h b/include/gfxconf.example.h
new file mode 100644
index 00000000..94413237
--- /dev/null
+++ b/include/gfxconf.example.h
@@ -0,0 +1,74 @@
+/**
+ * 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.
+ */
+
+/**
+ * Copy this file into your project directory and rename it as gfxconf.h
+ * Edit your copy to turn on the GFX features you want to use.
+ */
+
+#ifndef _GFXCONF_H
+#define _GFXCONF_H
+
+/* GFX sub-systems to turn on */
+#define GFX_USE_GDISP FALSE
+#define GFX_USE_GWIN FALSE
+#define GFX_USE_GEVENT FALSE
+#define GFX_USE_GTIMER FALSE
+#define GFX_USE_GINPUT 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 TRUE
+#define GDISP_NEED_ELLIPSE TRUE
+#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
+
+/* 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
+
+/* 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
+*/
+
+/* 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
+*/
+
+#endif /* _GFXCONF_H */
diff --git a/include/ginput.h b/include/ginput.h
deleted file mode 100644
index dc472e8e..00000000
--- a/include/ginput.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- ChibiOS/GFX - Copyright (C) 2012
- Joel Bodenmann aka Tectu <joel@unormal.org>
-
- This file is part of ChibiOS/GFX.
-
- ChibiOS/GFX is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- ChibiOS/GFX is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-/**
- * @file ginput.h
- * @brief GINPUT GFX User Input subsystem header file.
- *
- * @addtogroup GINPUT
- * @{
- */
-#ifndef _GINPUT_H
-#define _GINPUT_H
-
-#ifndef GFX_USE_GINPUT
- #define GFX_USE_GINPUT FALSE
-#endif
-
-#if GFX_USE_GINPUT || defined(__DOXYGEN__)
-
-/**
- * @name GINPUT more complex functionality to be compiled
- * @{
- */
-/** @} */
-
-/*===========================================================================*/
-/* Low Level Driver details and error checks. */
-/*===========================================================================*/
-
-#ifndef GFX_USE_GDISP
- #define GFX_USE_GDISP FALSE
-#endif
-#if GFX_USE_GDISP
- #include "gdisp.h"
-#else
- // We require some basic type definitions normally kept in gdisp.h
- typedef int16_t coord_t;
-#endif
-
-#ifndef GFX_USE_GEVENT
- #define GFX_USE_GEVENT TRUE
-#elif !GFX_USE_GEVENT
- #error "GINPUT: GFX_USE_GEVENT must be defined"
-#endif
-#include "gevent.h"
-
-#ifndef GFX_USE_GTIMER
- #define GFX_USE_GTIMER TRUE
-#elif !GFX_USE_GTIMER
- #error "GINPUT: GFX_USE_GTIMER must be defined"
-#endif
-
-/*===========================================================================*/
-/* Type definitions */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-/* How to use...
-
- 1. Get source handles for all the inputs you are interested in.
- - Attempting to get a handle for one instance of an input more than once will return the same handle
- 2. Create a listener
- 3. Assign inputs to your listener.
- - Inputs can be assigned or released from a listener at any time.
- - An input can be assigned to more than one listener.
- 4. Loop on getting listener events
- 5. When complete destroy the listener
-*/
-
-// Include various ginput types
-#include "ginput/ginput_mouse.h"
-#include "ginput/ginput_keyboard.h"
-#include "ginput/ginput_toggle.h"
-#include "ginput/ginput_dial.h"
-
-#endif /* GFX_USE_GINPUT */
-
-#endif /* _GINPUT_H */
-/** @} */
diff --git a/include/ginput/ginput_dial.h b/include/ginput/dial.h
index 71448c0b..90db94ac 100644
--- a/include/ginput/ginput_dial.h
+++ b/include/ginput/dial.h
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * @file ginput/ginput_dial.h
+ * @file include/ginput/dial.h
* @brief GINPUT GFX User Input subsystem header file.
*
* @addtogroup GINPUT
@@ -27,26 +27,9 @@
#ifndef _GINPUT_DIAL_H
#define _GINPUT_DIAL_H
-/**
- * @name GINPUT more complex functionality to be compiled
- * @{
- */
- /**
- * @brief Should analog dial functions be included.
- * @details Defaults to FALSE
- */
- #ifndef GINPUT_NEED_DIAL
- #define GINPUT_NEED_DIAL FALSE
- #endif
-/** @} */
-
#if GINPUT_NEED_DIAL || defined(__DOXYGEN__)
/*===========================================================================*/
-/* Low Level Driver details and error checks. */
-/*===========================================================================*/
-
-/*===========================================================================*/
/* Type definitions */
/*===========================================================================*/
diff --git a/include/ginput/ginput.h b/include/ginput/ginput.h
new file mode 100644
index 00000000..ec8acca7
--- /dev/null
+++ b/include/ginput/ginput.h
@@ -0,0 +1,55 @@
+/*
+ ChibiOS/GFX - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS/GFX.
+
+ ChibiOS/GFX is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/GFX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+/**
+ * @file include/ginput/ginput.h
+ * @brief GINPUT GFX User Input subsystem header file.
+ *
+ * @addtogroup GINPUT
+ * @{
+ */
+#ifndef _GINPUT_H
+#define _GINPUT_H
+
+#include "gfx.h"
+
+#if GFX_USE_GINPUT || defined(__DOXYGEN__)
+
+/* How to use...
+
+ 1. Get source handles for all the inputs you are interested in.
+ - Attempting to get a handle for one instance of an input more than once will return the same handle
+ 2. Create a listener
+ 3. Assign inputs to your listener.
+ - Inputs can be assigned or released from a listener at any time.
+ - An input can be assigned to more than one listener.
+ 4. Loop on getting listener events
+ 5. When complete destroy the listener
+*/
+
+// Include various ginput types
+#include "ginput/mouse.h"
+#include "ginput/keyboard.h"
+#include "ginput/toggle.h"
+#include "ginput/dial.h"
+
+#endif /* GFX_USE_GINPUT */
+
+#endif /* _GINPUT_H */
+/** @} */
diff --git a/include/ginput/ginput_keyboard.h b/include/ginput/keyboard.h
index 850adf38..cbb11194 100644
--- a/include/ginput/ginput_keyboard.h
+++ b/include/ginput/keyboard.h
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * @file ginput/ginput_keyboard.h
+ * @file include/ginput/keyboard.h
* @brief GINPUT GFX User Input subsystem header file.
*
* @addtogroup GINPUT
@@ -27,26 +27,9 @@
#ifndef _GINPUT_KEYBOARD_H
#define _GINPUT_KEYBOARD_H
-/**
- * @name GINPUT more complex functionality to be compiled
- * @{
- */
- /**
- * @brief Should keyboard functions be included.
- * @details Defaults to FALSE
- */
- #ifndef GINPUT_NEED_KEYBOARD
- #define GINPUT_NEED_KEYBOARD FALSE
- #endif
-/** @} */
-
#if GINPUT_NEED_KEYBOARD || defined(__DOXYGEN__)
/*===========================================================================*/
-/* Low Level Driver details and error checks. */
-/*===========================================================================*/
-
-/*===========================================================================*/
/* Type definitions */
/*===========================================================================*/
diff --git a/include/lld/ginput/mouse.h b/include/ginput/lld/mouse.h
index 423a6c3e..09a0fb6a 100644
--- a/include/lld/ginput/mouse.h
+++ b/include/ginput/lld/mouse.h
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * @file lld/ginput/mouse.h
+ * @file include/ginput/lld/mouse.h
* @brief GINPUT LLD header file for mouse/touch drivers.
*
* @addtogroup GINPUT_MOUSE
@@ -27,14 +27,7 @@
#ifndef _LLD_GINPUT_MOUSE_H
#define _LLD_GINPUT_MOUSE_H
-#ifndef GINPUT_NEED_MOUSE
- #define GINPUT_NEED_MOUSE FALSE
-#endif
-#ifndef GINPUT_NEED_TOUCH
- #define GINPUT_NEED_TOUCH FALSE
-#endif
-
-#if GINPUT_NEED_MOUSE || GINPUT_NEED_TOUCH
+#if GINPUT_NEED_MOUSE || defined(__DOXYGEN__)
#include "ginput_lld_mouse_config.h"
diff --git a/include/lld/ginput/toggle.h b/include/ginput/lld/toggle.h
index 72b097f0..2b437ed9 100644
--- a/include/lld/ginput/toggle.h
+++ b/include/ginput/lld/toggle.h
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * @file lld/ginput/toggle.h
+ * @file include/ginput/lld/toggle.h
* @brief GINPUT header file for toggle drivers.
*
* @addtogroup GINPUT_TOGGLE
@@ -27,14 +27,7 @@
#ifndef _LLD_GINPUT_TOGGLE_H
#define _LLD_GINPUT_TOGGLE_H
-#ifndef GFX_USE_GINPUT
- #define GFX_USE_GINPUT FALSE
-#endif
-#ifndef GINPUT_NEED_TOGGLE
- #define GINPUT_NEED_TOGGLE FALSE
-#endif
-
-#if (GFX_USE_GINPUT && GINPUT_NEED_TOGGLE) || defined(__DOXYGEN__)
+#if GINPUT_NEED_TOGGLE || defined(__DOXYGEN__)
// Describes how the toggle bits are obtained
typedef struct GToggleConfig_t {
@@ -44,14 +37,6 @@ typedef struct GToggleConfig_t {
iomode_t mode;
} GToggleConfig;
-// This must be included after the above type definition
-#include "ginput.h"
-
-// n - Millisecs between poll's
-#ifndef GINPUT_TOGGLE_POLL_PERIOD
- #define GINPUT_TOGGLE_POLL_PERIOD 200
-#endif
-
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
diff --git a/include/ginput/ginput_mouse.h b/include/ginput/mouse.h
index 1b596ac9..0aaea77b 100644
--- a/include/ginput/ginput_mouse.h
+++ b/include/ginput/mouse.h
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * @file ginput/ginput_mouse.h
+ * @file include/ginput/mouse.h
* @brief GINPUT GFX User Input subsystem header file for mouse and touch.
*
* @addtogroup GINPUT
@@ -27,25 +27,12 @@
#ifndef _GINPUT_MOUSE_H
#define _GINPUT_MOUSE_H
-/**
- * @name GINPUT more complex functionality to be compiled
- * @{
- */
- /**
- * @brief Should mouse/touch functions be included.
- * @details Defaults to FALSE
- */
- #ifndef GINPUT_NEED_MOUSE
- #define GINPUT_NEED_MOUSE FALSE
- #endif
-/** @} */
+#if GINPUT_NEED_MOUSE || defined(__DOXYGEN__)
/*===========================================================================*/
/* Type definitions */
/*===========================================================================*/
-#if GINPUT_NEED_MOUSE || defined(__DOXYGEN__)
-
/* This type definition is also used by touch */
typedef struct GEventMouse_t {
GEventType type; // The type of this event (GEVENT_MOUSE or GEVENT_TOUCH)
diff --git a/include/ginput/options.h b/include/ginput/options.h
new file mode 100644
index 00000000..e7635fb5
--- /dev/null
+++ b/include/ginput/options.h
@@ -0,0 +1,127 @@
+/*
+ ChibiOS/GFX - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS/GFX.
+
+ ChibiOS/GFX is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/GFX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file include/ginput/options.h
+ * @brief GINPUT sub-system options header file.
+ *
+ * @addtogroup GINPUT
+ * @{
+ */
+
+#ifndef _GINPUT_OPTIONS_H
+#define _GINPUT_OPTIONS_H
+
+/**
+ * @name GINPUT Functionality to be included
+ * @{
+ */
+ /**
+ * @brief Should mouse/touch functions be included.
+ * @details Defaults to FALSE
+ * @note Also add the a mouse/touch hardware driver to your makefile.
+ * Eg.
+ * include $(GFXLIB)/drivers/ginput/touch/MCU/ginput_lld.mk
+ */
+ #ifndef GINPUT_NEED_MOUSE
+ #define GINPUT_NEED_MOUSE FALSE
+ #endif
+ /**
+ * @brief Should keyboard functions be included.
+ * @details Defaults to FALSE
+ * @note Also add the a keyboard hardware driver to your makefile.
+ * Eg.
+ * include $(GFXLIB)/drivers/ginput/keyboard/XXXX/ginput_lld.mk
+ */
+ #ifndef GINPUT_NEED_KEYBOARD
+ #define GINPUT_NEED_KEYBOARD FALSE
+ #endif
+ /**
+ * @brief Should hardware toggle/switch/button functions be included.
+ * @details Defaults to FALSE
+ * @note Also add the a toggle hardware driver to your makefile.
+ * Eg.
+ * include $(GFXLIB)/drivers/ginput/toggle/Pal/ginput_lld.mk
+ */
+ #ifndef GINPUT_NEED_TOGGLE
+ #define GINPUT_NEED_TOGGLE FALSE
+ #endif
+ /**
+ * @brief Should analog dial functions be included.
+ * @details Defaults to FALSE
+ * @note Also add the a dial hardware driver to your makefile.
+ * Eg.
+ * include $(GFXLIB)/drivers/ginput/dial/analog/ginput_lld.mk
+ */
+ #ifndef GINPUT_NEED_DIAL
+ #define GINPUT_NEED_DIAL FALSE
+ #endif
+/**
+ * @}
+ *
+ * @name GINPUT Optional Sizing Parameters
+ * @{
+ */
+/**
+ * @}
+ *
+ * @name GINPUT Optional Low Level Driver Defines
+ * @{
+ */
+ /**
+ * @brief Use a custom board definition for the mouse/touch driver even if a board definition exists.
+ * @details Defaults to FALSE
+ * @details If TRUE, add ginput_lld_mouse_board.h to your project directory and customise it.
+ * @note Not all GINPUT mouse/touch low level drivers use board definition files.
+ */
+ #ifndef GINPUT_MOUSE_USE_CUSTOM_BOARD
+ #define GINPUT_MOUSE_USE_CUSTOM_BOARD FALSE
+ #endif
+ /**
+ * @brief Use a custom board definition for the keyboard driver even if a board definition exists.
+ * @details Defaults to FALSE
+ * @details If TRUE, add ginput_lld_keyboard_board.h to your project directory and customise it.
+ * @note Not all GINPUT keyboard low level drivers use board definition files.
+ */
+ #ifndef GINPUT_KEYBOARD_USE_CUSTOM_BOARD
+ #define GINPUT_KEYBOARD_USE_CUSTOM_BOARD FALSE
+ #endif
+ /**
+ * @brief Use a custom board definition for the toggle driver even if a board definition exists.
+ * @details Defaults to FALSE
+ * @details If TRUE, add ginput_lld_toggle_board.h to your project directory and customise it.
+ * @note Not all GINPUT toggle low level drivers use board definition files.
+ */
+ #ifndef GINPUT_TOGGLE_USE_CUSTOM_BOARD
+ #define GINPUT_TOGGLE_USE_CUSTOM_BOARD FALSE
+ #endif
+ /**
+ * @brief Use a custom board definition for the dial driver even if a board definition exists.
+ * @details Defaults to FALSE
+ * @details If TRUE, add ginput_lld_dial_board.h to your project directory and customise it.
+ * @note Not all GINPUT dial low level drivers use board definition files.
+ */
+ #ifndef GINPUT_DIAL_USE_CUSTOM_BOARD
+ #define GINPUT_DIAL_USE_CUSTOM_BOARD FALSE
+ #endif
+/** @} */
+
+#endif /* _GINPUT_OPTIONS_H */
+/** @} */
diff --git a/include/ginput/ginput_toggle.h b/include/ginput/toggle.h
index 10be1da9..2dce9726 100644
--- a/include/ginput/ginput_toggle.h
+++ b/include/ginput/toggle.h
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * @file ginput/ginput_toggle.h
+ * @file include/ginput/toggle.h
* @brief GINPUT GFX User Input subsystem header file.
*
* @addtogroup GINPUT
@@ -27,25 +27,15 @@
#ifndef _GINPUT_TOGGLE_H
#define _GINPUT_TOGGLE_H
-/**
- * @name GINPUT more complex functionality to be compiled
- * @{
- */
- /**
- * @brief Should hardware toggle/switch/button (pio) functions be included.
- * @details Defaults to FALSE
- */
- #ifndef GINPUT_NEED_TOGGLE
- #define GINPUT_NEED_TOGGLE FALSE
- #endif
-/** @} */
-
#if GINPUT_NEED_TOGGLE || defined(__DOXYGEN__)
/*===========================================================================*/
/* Low Level Driver details and error checks. */
/*===========================================================================*/
+// Get the hardware definitions - Number of instances etc.
+#include "ginput_lld_toggle_config.h"
+
/*===========================================================================*/
/* Type definitions */
/*===========================================================================*/
@@ -53,9 +43,6 @@
// Event types for various ginput sources
#define GEVENT_TOGGLE (GEVENT_GINPUT_FIRST+3)
-// Get the hardware definitions - Number of instances etc.
-#include "ginput_lld_toggle_config.h"
-
typedef struct GEventToggle_t {
GEventType type; // The type of this event (GEVENT_TOGGLE)
uint16_t instance; // The toggle instance
diff --git a/include/graph.h b/include/graph.h
deleted file mode 100644
index bc0d3d15..00000000
--- a/include/graph.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- ChibiOS/GFX - Copyright (C) 2012
- Joel Bodenmann aka Tectu <joel@unormal.org>
-
- This file is part of ChibiOS/GFX.
-
- ChibiOS/GFX is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- ChibiOS/GFX is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file include/graph.h
- * @brief GRAPH module header file.
- *
- * @addtogroup GRAPH
- * @{
- */
-
-#ifndef GRAPH_H
-#define GRAPH_H
-
-#ifndef GFX_USE_GRAPH
- #define GFX_USE_GRAPH FALSE
-#endif
-
-#if GFX_USE_GRAPH || defined(__DOXYGEN__)
-
-/*===========================================================================*/
-/* Type definitions */
-/*===========================================================================*/
-
-typedef struct _Graph {
- coord_t origin_x;
- coord_t origin_y;
- coord_t xmin;
- coord_t xmax;
- coord_t ymin;
- coord_t ymax;
- uint16_t grid_size;
- uint16_t dot_space;
- bool_t full_grid;
- bool_t arrows;
- color_t axis_color;
- color_t grid_color;
-
- /* do never modify values below this line manually */
- coord_t x0;
- coord_t x1;
- coord_t y0;
- coord_t y1;
-} Graph;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*===========================================================================*/
-/* Type definitions */
-/*===========================================================================*/
-
-void graphDrawSystem(Graph *g);
-void graphDrawDot(Graph *g, coord_t x, coord_t y, uint16_t radius, color_t color);
-void graphDrawDots(Graph *g, int coord[][2], uint16_t entries, uint16_t radius, uint16_t color);
-void graphDrawNet(Graph *g, int coord[][2], uint16_t entries, uint16_t radius, uint16_t lineColor, uint16_t dotColor);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GFX_USE_GRAPH */
-
-#endif
-/** @} */
-
diff --git a/include/gtimer.h b/include/gtimer/gtimer.h
index cf25ac8a..623120dc 100644
--- a/include/gtimer.h
+++ b/include/gtimer/gtimer.h
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * @file gtimer.h
+ * @file include/gtimer/gtimer.h
* @brief GTIMER GFX User Timer subsystem header file.
*
* @addtogroup GTIMER
@@ -27,46 +27,27 @@
#ifndef _GTIMER_H
#define _GTIMER_H
-#ifndef GFX_USE_GTIMER
- #define GFX_USE_GTIMER FALSE
-#endif
+#include "gfx.h"
#if GFX_USE_GTIMER || defined(__DOXYGEN__)
-/**
- * @name GTIMER macros and more complex functionality to be compiled
- * @{
- */
- /**
- * @brief Data part of a static GTimer initializer.
- */
- #define _GTIMER_DATA() {0,0,0,0,0,0,0}
- /**
- * @brief Static GTimer initializer.
- */
- #define GTIMER_DECL(name) GTimer name = _GTIMER_DATA()
- /**
- * @brief Defines the size of the timer threads work area (stack+structures).
- * @details Defaults to 512 bytes
- */
- #ifndef GTIMER_THREAD_STACK_SIZE
- #define GTIMER_THREAD_STACK_SIZE 512
- #endif
-/** @} */
-
/*===========================================================================*/
-/* Low Level Driver details and error checks. */
+/* Type definitions */
/*===========================================================================*/
-#if !CH_USE_MUTEXES || !CH_USE_SEMAPHORES
- #error "GTIMER: CH_USE_MUTEXES and CH_USE_SEMAPHORES must be defined in chconf.h"
-#endif
+/**
+ * @brief Data part of a static GTimer initializer.
+ */
+#define _GTIMER_DATA() {0,0,0,0,0,0,0}
-/*===========================================================================*/
-/* Type definitions */
-/*===========================================================================*/
+/**
+ * @brief Static GTimer initializer.
+ */
+#define GTIMER_DECL(name) GTimer name = _GTIMER_DATA()
-// A callback function (executed in a thread context)
+/**
+ * @brief A callback function (executed in a thread context).
+ */
typedef void (*GTimerFunction)(void *param);
/**
diff --git a/include/gtimer/options.h b/include/gtimer/options.h
new file mode 100644
index 00000000..e0770627
--- /dev/null
+++ b/include/gtimer/options.h
@@ -0,0 +1,52 @@
+/*
+ ChibiOS/GFX - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS/GFX.
+
+ ChibiOS/GFX is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/GFX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file include/gtimer/options.h
+ * @brief GTIMER sub-system options header file.
+ *
+ * @addtogroup GTIMER
+ * @{
+ */
+
+#ifndef _GTIMER_OPTIONS_H
+#define _GTIMER_OPTIONS_H
+
+/**
+ * @name GTIMER Functionality to be included
+ * @{
+ */
+/**
+ * @}
+ *
+ * @name GTIMER Optional Sizing Parameters
+ * @{
+ */
+ /**
+ * @brief Defines the size of the timer threads work area (stack+structures).
+ * @details Defaults to 512 bytes
+ */
+ #ifndef GTIMER_THREAD_WORKAREA_SIZE
+ #define GTIMER_THREAD_WORKAREA_SIZE 512
+ #endif
+/** @} */
+
+#endif /* _GTIMER_OPTIONS_H */
+/** @} */
diff --git a/include/gwin/gwin_button.h b/include/gwin/button.h
index e95628e4..6fc564c7 100644
--- a/include/gwin/gwin_button.h
+++ b/include/gwin/button.h
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * @file gwin/gwin_button.h
+ * @file include/gwin/button.h
* @brief GWIN Graphic window subsystem header file.
*
* @addtogroup GWIN
@@ -27,20 +27,6 @@
#ifndef _GWIN_BUTTON_H
#define _GWIN_BUTTON_H
-/**
- * @name GWIN more complex functionality to be compiled
- * @{
- */
- /**
- * @brief Should button functions be included.
- * @details Defaults to FALSE
- */
- #ifndef GWIN_NEED_BUTTON
- #define GWIN_NEED_BUTTON FALSE
- #endif
-
-/** @} */
-
#if GWIN_NEED_BUTTON || defined(__DOXYGEN__)
/*===========================================================================*/
@@ -51,24 +37,6 @@
#define GEVENT_GWIN_BUTTON (GEVENT_GWIN_FIRST+0)
/*===========================================================================*/
-/* Driver pre-compile time settings. */
-/*===========================================================================*/
-
-
-/*===========================================================================*/
-/* Low Level Driver details and error checks. */
-/*===========================================================================*/
-
-#if !GDISP_NEED_TEXT
- #error "GWIN: Text support (GDISP_NEED_TEXT) is required if GWIN_NEED_BUTTON is defined."
-#endif
-
-#if !defined(GFX_USE_GEVENT) || !GFX_USE_GEVENT
- #error "GWIN Buttons require GFX_USE_GEVENT"
-#endif
-#include "gevent.h"
-
-/*===========================================================================*/
/* Type definitions */
/*===========================================================================*/
diff --git a/include/gwin/gwin_console.h b/include/gwin/console.h
index 5462ec2b..4e78d747 100644
--- a/include/gwin/gwin_console.h
+++ b/include/gwin/console.h
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * @file gwin/gwin_console.h
+ * @file include/gwin/console.h
* @brief GWIN Graphic window subsystem header file.
*
* @addtogroup GWIN
@@ -27,19 +27,6 @@
#ifndef _GWIN_CONSOLE_H
#define _GWIN_CONSOLE_H
-/**
- * @name GWIN more complex functionality to be compiled
- * @{
- */
- /**
- * @brief Should console functions be included.
- * @details Defaults to FALSE
- */
- #ifndef GWIN_NEED_CONSOLE
- #define GWIN_NEED_CONSOLE FALSE
- #endif
-/** @} */
-
#if GWIN_NEED_CONSOLE || defined(__DOXYGEN__)
/*===========================================================================*/
@@ -49,18 +36,6 @@
#define GW_CONSOLE 0x0001
/*===========================================================================*/
-/* Driver pre-compile time settings. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Low Level Driver details and error checks. */
-/*===========================================================================*/
-
-#if GWIN_NEED_CONSOLE && !GDISP_NEED_TEXT
- #error "GWIN: Text support (GDISP_NEED_TEXT) is required if GWIN_NEED_CONSOLE is defined."
-#endif
-
-/*===========================================================================*/
/* Type definitions */
/*===========================================================================*/
diff --git a/include/gwin/graph.h b/include/gwin/graph.h
new file mode 100644
index 00000000..752460cb
--- /dev/null
+++ b/include/gwin/graph.h
@@ -0,0 +1,156 @@
+/*
+ ChibiOS/GFX - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS/GFX.
+
+ ChibiOS/GFX is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/GFX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file include/gwin/graph.h
+ * @brief GWIN GRAPH module header file.
+ *
+ * @addtogroup GWIN_GRAPH
+ * @{
+ */
+
+#ifndef _GWIN_GRAPH_H
+#define _GWIN_GRAPH_H
+
+#if GWIN_NEED_GRAPH || defined(__DOXYGEN__)
+
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+#define GW_GRAPH 0x0003
+
+/*===========================================================================*/
+/* Type definitions */
+/*===========================================================================*/
+
+typedef struct GGraphPoint_t {
+ coord_t x, y;
+ } GGraphPoint;
+
+typedef enum GGraphPointType_e {
+ GGRAPH_POINT_NONE, GGRAPH_POINT_DOT, GGRAPH_POINT_SQUARE, GGRAPH_POINT_CIRCLE
+ } GGraphPointType;
+
+typedef struct GGraphPointStyle_t {
+ GGraphPointType type;
+ coord_t size;
+ color_t color;
+ } GGraphPointStyle;
+
+typedef enum GGraphLineType_e {
+ GGRAPH_LINE_NONE, GGRAPH_LINE_SOLID, GGRAPH_LINE_DOT, GGRAPH_LINE_DASH
+ } GGraphLineType;
+
+typedef struct GGraphLineStyle_t {
+ GGraphLineType type;
+ coord_t size;
+ color_t color;
+ } GGraphLineStyle;
+
+typedef struct GGraphGridStyle_t {
+ GGraphLineType type;
+ coord_t size;
+ color_t color;
+ coord_t spacing;
+ } GGraphGridStyle;
+
+typedef struct GGraphStyle_t {
+ GGraphPointStyle point;
+ GGraphLineStyle line;
+ GGraphLineStyle xaxis;
+ GGraphLineStyle yaxis;
+ GGraphGridStyle xgrid;
+ GGraphGridStyle ygrid;
+ uint16_t flags;
+ #define GWIN_GRAPH_STYLE_XAXIS_ARROWS 0x0001
+ #define GWIN_GRAPH_STYLE_YAXIS_ARROWS 0x0002
+} GGraphStyle;
+
+// A graph window
+typedef struct GGraphObject_t {
+ GWindowObject gwin;
+ GGraphStyle style;
+ coord_t xorigin, yorigin;
+ coord_t lastx, lasty;
+ } GGraphObject;
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ GHandle gwinCreateGraph(GGraphObject *gg, coord_t x, coord_t y, coord_t width, coord_t height);
+ void gwinGraphSetStyle(GHandle gh, const GGraphStyle *pstyle);
+ void gwinGraphSetOrigin(GHandle gh, coord_t x, coord_t y);
+ void gwinGraphDrawAxis(GHandle gh);
+ void gwinGraphStartSet(GHandle gh);
+ void gwinGraphDrawPoint(GHandle gh, coord_t x, coord_t y);
+ void gwinGraphDrawPoints(GHandle gh, const GGraphPoint *points, unsigned count);
+
+#ifdef __cplusplus
+}
+#endif
+
+/*===========================================================================*/
+/* Type definitions */
+/*===========================================================================*/
+
+typedef struct _Graph {
+ coord_t origin_x;
+ coord_t origin_y;
+ coord_t xmin;
+ coord_t xmax;
+ coord_t ymin;
+ coord_t ymax;
+ uint16_t grid_size;
+ uint16_t dot_space;
+ bool_t full_grid;
+ bool_t arrows;
+ color_t axis_color;
+ color_t grid_color;
+
+ /* do never modify values below this line manually */
+ coord_t x0;
+ coord_t x1;
+ coord_t y0;
+ coord_t y1;
+} Graph;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*===========================================================================*/
+/* Type definitions */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GWIN_NEED_GRAPH */
+
+#endif /* _GWIN_GRAPH_H */
+/** @} */
+
diff --git a/include/gwin.h b/include/gwin/gwin.h
index f54c8d37..cca02d7e 100644
--- a/include/gwin.h
+++ b/include/gwin/gwin.h
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
- * @file gwin.h
+ * @file include/gwin/gwin.h
* @brief GWIN Graphic window subsystem header file.
*
* @addtogroup GWIN
@@ -27,40 +27,11 @@
#ifndef _GWIN_H
#define _GWIN_H
-#ifndef GFX_USE_GWIN
- #define GFX_USE_GWIN FALSE
-#endif
+#include "gfx.h"
#if GFX_USE_GWIN || defined(__DOXYGEN__)
/*===========================================================================*/
-/* Driver constants. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Driver pre-compile time settings. */
-/*===========================================================================*/
-
-/**
- * @name GWIN more complex functionality to be compiled
- * @{
- */
-/** @} */
-
-/*===========================================================================*/
-/* Low Level Driver details and error checks. */
-/*===========================================================================*/
-
-#if !defined(GFX_USE_GDISP) || !GFX_USE_GDISP
- #error "GWIN: GFX_USE_GDISP must also be defined"
-#endif
-#include "gdisp.h"
-
-#if !GDISP_NEED_CLIP
- #warning "GWIN: Drawing can occur outside the defined window as GDISP_NEED_CLIP is FALSE"
-#endif
-
-/*===========================================================================*/
/* Type definitions */
/*===========================================================================*/
@@ -145,7 +116,7 @@ void gwinDestroyWindow(GHandle gh);
/* Set up for text */
#if GDISP_NEED_TEXT
-void gwinSetFont(GHandle gh, font_t font);
+ void gwinSetFont(GHandle gh, font_t font);
#endif
/* Drawing Functions */
@@ -194,8 +165,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
#endif
/* Include extra window types */
-#include "gwin/gwin_console.h"
-#include "gwin/gwin_button.h"
+#include "gwin/console.h"
+#include "gwin/button.h"
+#include "gwin/graph.h"
#endif /* GFX_USE_GWIN */
diff --git a/include/gwin/internal.h b/include/gwin/internal.h
new file mode 100644
index 00000000..b47a2229
--- /dev/null
+++ b/include/gwin/internal.h
@@ -0,0 +1,53 @@
+/*
+ ChibiOS/GFX - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS/GFX.
+
+ ChibiOS/GFX is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/GFX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+/**
+ * @file include/gwin/internal.h
+ * @brief GWIN Graphic window subsystem header file.
+ *
+ * @addtogroup GWIN
+ * @{
+ */
+#ifndef _GWIN_INTERNAL_H
+#define _GWIN_INTERNAL_H
+
+#if GFX_USE_GWIN || defined(__DOXYGEN__)
+
+/*===========================================================================*/
+/* Sub-system constants. */
+/*===========================================================================*/
+
+#define GWIN_FLG_DYNAMIC 0x0001
+#define GBTN_FLG_ALLOCTXT 0x0002
+#define GWIN_FIRST_CONTROL_FLAG 0x0004
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GHandle _gwinInit(GWindowObject *gw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GFX_USE_GWIN */
+
+#endif /* _GWIN_INTERNAL_H */
+/** @} */
diff --git a/include/gwin/options.h b/include/gwin/options.h
new file mode 100644
index 00000000..899da5a4
--- /dev/null
+++ b/include/gwin/options.h
@@ -0,0 +1,71 @@
+/*
+ ChibiOS/GFX - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS/GFX.
+
+ ChibiOS/GFX is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/GFX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file include/gwin_options.h
+ * @brief GWIN sub-system options header file.
+ *
+ * @addtogroup GWIN
+ * @{
+ */
+
+#ifndef _GWIN_OPTIONS_H
+#define _GWIN_OPTIONS_H
+
+/**
+ * @name GWIN Functionality to be included
+ * @{
+ */
+ /**
+ * @brief Should button functions be included.
+ * @details Defaults to FALSE
+ */
+ #ifndef GWIN_NEED_BUTTON
+ #define GWIN_NEED_BUTTON FALSE
+ #endif
+ /**
+ * @brief Should console functions be included.
+ * @details Defaults to FALSE
+ * @note To use chprintf() for printing in a console window you need to
+ * include in your application source file...
+ * #include "chprintf.h"
+ * Also in your makefile, as part of your list of C source files, include
+ * ${CHIBIOS}/os/various/chprintf.c
+ */
+ #ifndef GWIN_NEED_CONSOLE
+ #define GWIN_NEED_CONSOLE FALSE
+ #endif
+ /**
+ * @brief Should graph functions be included.
+ * @details Defaults to FALSE
+ */
+ #ifndef GWIN_NEED_GRAPH
+ #define GWIN_NEED_GRAPH FALSE
+ #endif
+/**
+ * @}
+ *
+ * @name GWIN Optional Sizing Parameters
+ * @{
+ */
+/** @} */
+
+#endif /* _GWIN_OPTIONS_H */
+/** @} */
diff --git a/include/lld/touchscreen/touchscreen_lld.h b/include/lld/touchscreen/touchscreen_lld.h
deleted file mode 100644
index 912d2464..00000000
--- a/include/lld/touchscreen/touchscreen_lld.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- ChibiOS/GFX - Copyright (C) 2012
- Joel Bodenmann aka Tectu <joel@unormal.org>
-
- This file is part of ChibiOS/GFX.
-
- ChibiOS/GFX is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- ChibiOS/GFX is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file include/lld/touchscreen/touchscreen_lld.h
- * @brief TOUCHSCREEN Driver subsystem low level driver header.
- *
- * @addtogroup TOUCHSCREEN
- * @{
- */
-
-#ifndef TOUCHSCREEN_LLD_H
-#define TOUCHSCREEN_LLD_H
-
-#if GFX_USE_TOUCHSCREEN || defined(__DOXYGEN__)
-
-/*===========================================================================*/
-/* Include the low level driver configuration information */
-/*===========================================================================*/
-
-#include "touchscreen_lld_config.h"
-
-/*===========================================================================*/
-/* Error checks. */
-/*===========================================================================*/
-
-#ifndef TOUCHSCREEN_NEED_MULTITHREAD
- #define TOUCHSCREEN_NEED_MULTITHREAD FALSE
-#endif
-
-#ifndef TOUCHSCREEN_XY_INVERTED
- #define TOUCHSCREEN_XY_INVERTED FALSE
-#endif
-
-#ifndef TOUCHSCREEN_HAS_PRESSED
- #define TOUCHSCREEN_HAS_PRESSED FALSE
-#endif
-
-#ifndef TOUCHSCREEN_HAS_PRESSURE
- #define TOUCHSCREEN_HAS_PRESSURE FALSE
-#endif
-
-#ifndef TOUCHSCREEN_SPI_PROLOGUE
- #define TOUCHSCREEN_SPI_PROLOGUE()
-#endif
-
-#ifndef TOUCHSCREEN_SPI_EPILOGUE
- #define TOUCHSCREEN_SPI_EPILOGUE()
-#endif
-
-#ifndef TOUCHSCREEN_STORE_CALIBRATION
- #define TOUCHSCREEN_STORE_CALIBRATION FALSE
-#endif
-
-#ifndef TOUCHSCREEN_VERIFY_CALIBRATION
- #define TOUCHSCREEN_VERIFY_CALIBRATION FALSE
-#endif
-
-#ifndef TOUCHSCREEN_CONVERSIONS
- #define TOUCHSCREEN_CONVERSIONS 3
-#endif
-
-/*===========================================================================*/
-/* Driver types. */
-/*===========================================================================*/
-
-/**
- * @brief Structure representing a touchscreen driver. Hardware dependant.
- */
-typedef struct TouchscreenDriver TouchscreenDriver;
-
-// Forward declaration
-struct cal_t;
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /* Core functions */
- void ts_lld_init(const TouchscreenDriver *ts);
-
- uint16_t ts_lld_read_value(uint8_t cmd);
- uint16_t ts_lld_read_x(void);
- uint16_t ts_lld_read_y(void);
-
- #if TOUCHSCREEN_HAS_PRESSED
- uint8_t ts_lld_pressed(void);
- #endif
-
- #if TOUCHSCREEN_HAS_PRESSURE
- uint16_t ts_lld_read_z(void);
- #endif
-
- #if TOUCHSCREEN_STORE_CALIBRATION
- // These may be defined by the low level driver or by the application
- void ts_store_calibration_lld(struct cal_t *cal);
- struct cal_t *ts_restore_calibration_lld(void);
- #endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GFX_USE_TOUCHSCREEN */
-
-#endif /* _TOUCHSCREEN_LLD_H */
-/** @} */
-
diff --git a/include/touchscreen.h b/include/touchscreen.h
deleted file mode 100644
index 5a84afdf..00000000
--- a/include/touchscreen.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- ChibiOS/GFX - Copyright (C) 2012
- Joel Bodenmann aka Tectu <joel@unormal.org>
-
- This file is part of ChibiOS/GFX.
-
- ChibiOS/GFX is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- ChibiOS/GFX is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file include/touchscreen.h
- * @brief TOUCHSCREEN Touchscreen driver subsystem header file.
- *
- * @addtogroup TOUCHSCREEN
- * @{
- */
-
-#ifndef TOUCHSCREEN_H
-#define TOUCHSCREEN_H
-
-#if GFX_USE_TOUCHSCREEN || defined(__DOXYGEN__)
-
-/*===========================================================================*/
-/* Driver constants. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Low Level Driver details and error checks. */
-/*===========================================================================*/
-
-/* Include the low level driver information */
-#include "lld/touchscreen/touchscreen_lld.h"
-
-/* For definitions of coord_t, we require gdisp.h */
-#include "gdisp.h"
-
-/*===========================================================================*/
-/* Type definitions */
-/*===========================================================================*/
-
-/**
- * @brief Struct used for calibration
- */
-typedef struct cal_t {
- float ax;
- float bx;
- float cx;
- float ay;
- float by;
- float cy;
-} cal_t;
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void tsInit(const TouchscreenDriver *ts);
-coord_t tsReadX(void);
-coord_t tsReadY(void);
-void tsCalibrate(void);
-
-#if TOUCHSCREEN_HAS_PRESSED
- bool_t tsPressed(void);
-#endif
-
-#if TOUCHSCREEN_HAS_PRESSURE
- uint16_t tsReadZ(void);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GFX_USE_TOUCHSCREEN */
-
-#endif /* TOUCHSCREEN_H */
-/** @} */
-