aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gfx.h8
-rw-r--r--gfxconf.example.h2
-rw-r--r--src/gfx.c22
3 files changed, 32 insertions, 0 deletions
diff --git a/gfx.h b/gfx.h
index 8be39815..541743e5 100644
--- a/gfx.h
+++ b/gfx.h
@@ -221,6 +221,14 @@ extern "C" {
* @note This will initialise each sub-system that has been turned on.
* For example, if GFX_USE_GDISP is defined then display will be initialised
* and cleared to black.
+ * @note If you define GFX_NO_OS_INIT as TRUE in your gfxconf.h file then ugfx doesn't try to
+ * initialise the operating system for you when you call @p gfxInit().
+ * @note If you define GFX_OS_EXTRA_INIT_FUNCTION in your gfxconf.h file the macro is the
+ * name of a void function with no parameters that is called immediately after
+ * operating system initialisation (whether or not GFX_NO_OS_INIT is set).
+ * @note If you define GFX_OS_EXTRA_DEINIT_FUNCTION in your gfxconf.h file the macro is the
+ * name of a void function with no parameters that is called immediately before
+ * operating system de-initialisation (as ugfx is exiting).
*
* @api
*/
diff --git a/gfxconf.example.h b/gfxconf.example.h
index 4c94bb18..7c0424fd 100644
--- a/gfxconf.example.h
+++ b/gfxconf.example.h
@@ -41,6 +41,8 @@
// Options that (should where relevant) apply to all operating systems
// #define GFX_NO_OS_INIT FALSE
+// #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine
+// #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine
///////////////////////////////////////////////////////////////////////////
diff --git a/src/gfx.c b/src/gfx.c
index 55874e20..fea9044b 100644
--- a/src/gfx.c
+++ b/src/gfx.c
@@ -20,10 +20,20 @@ static bool_t initDone = FALSE;
/* These init functions are defined by each module but not published */
extern void _gosInit(void);
extern void _gosDeinit(void);
+#ifdef GFX_OS_EXTRA_INIT_FUNCTION
+ extern void GFX_OS_EXTRA_INIT_FUNCTION(void);
+#endif
+#ifdef GFX_OS_EXTRA_DEINIT_FUNCTION
+ extern void GFX_OS_EXTRA_DEINIT_FUNCTION(void);
+#endif
#if GFX_USE_GDRIVER
extern void _gdriverInit(void);
extern void _gdriverDeinit(void);
#endif
+#if GFX_USE_GFILE
+ extern void _gfileInit(void);
+ extern void _gfileDeinit(void);
+#endif
#if GFX_USE_GDISP
extern void _gdispInit(void);
extern void _gdispDeinit(void);
@@ -71,6 +81,9 @@ void gfxInit(void)
// These must be initialised in the order of their dependancies
_gosInit();
+ #ifdef GFX_OS_EXTRA_INIT_FUNCTION
+ GFX_OS_EXTRA_INIT_FUNCTION();
+ #endif
#if GFX_USE_GQUEUE
_gqueueInit();
#endif
@@ -86,6 +99,9 @@ void gfxInit(void)
#if GFX_USE_GDRIVER
_gdriverInit();
#endif
+ #if GFX_USE_GFILE
+ _gfileInit();
+ #endif
#if GFX_USE_GDISP
_gdispInit();
#endif
@@ -125,6 +141,9 @@ void gfxDeinit(void)
#if GFX_USE_GDISP
_gdispDeinit();
#endif
+ #if GFX_USE_GFILE
+ _gfileDeinit();
+ #endif
#if GFX_USE_GDRIVER
_gdriverDeinit();
#endif
@@ -140,5 +159,8 @@ void gfxDeinit(void)
#if GFX_USE_GQUEUE
_gqueueDeinit();
#endif
+ #ifdef GFX_OS_EXTRA_DEINIT_FUNCTION
+ GFX_OS_EXTRA_DEINIT_FUNCTION();
+ #endif
_gosDeinit();
}