Browse Source

GFILE was not being initialised properly.

Added GFX_OS_EXTRA_INIT_FUNCTION and GFX_OS_EXTRA_DEINIT_FUNCTION macro's to enable special initialisation to occur being anything else happens.
remotes/origin_old/ugfx_release_2.6
inmarket 7 years ago
parent
commit
dc4f706132
  1. 8
      gfx.h
  2. 2
      gfxconf.example.h
  3. 22
      src/gfx.c

8
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
*/

2
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
///////////////////////////////////////////////////////////////////////////

22
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();
}
Loading…
Cancel
Save