From a11f7da53638ee4fe282c7b5725294ca1780f9bf Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Sun, 2 Feb 2014 19:24:43 +0100 Subject: added deinit() routines for all modules (not implemented so far) --- src/gfx.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 10 deletions(-) (limited to 'src/gfx.c') diff --git a/src/gfx.c b/src/gfx.c index ff7b29cd..46003f09 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -15,47 +15,50 @@ #include "gfx.h" -void DEPRECATED("Use gfxInit() instead") gdispInit() { gfxInit(); } - /* These init functions are defined by each module but not published */ extern void _gosInit(void); +extern void _gosDeinit(void); #if GFX_USE_GDISP extern void _gdispInit(void); + extern void _gdispDeinit(void); #endif #if GFX_USE_GWIN extern void _gwinInit(void); + extern void _gwinDeinit(void); #endif #if GFX_USE_GEVENT extern void _geventInit(void); + extern void _geventDeinit(void); #endif #if GFX_USE_GTIMER extern void _gtimerInit(void); + extern void _gtimerDeinit(void); #endif #if GFX_USE_GINPUT extern void _ginputInit(void); + extern void _ginputDeinit(void); #endif #if GFX_USE_GADC extern void _gadcInit(void); + extern void _gadcDeinit(void); #endif #if GFX_USE_GAUDIN extern void _gaudinInit(void); + extern void _gaudinDeinit(void); #endif #if GFX_USE_GAUDOUT extern void _gaudoutInit(void); + extern void _gaudoutDeinit(void); #endif #if GFX_USE_GMISC extern void _gmiscInit(void); + extern void _gmiscDeinit(void); #endif -void gfxInit(void) { - static bool_t initDone = FALSE; - - /* Ensure we only initialise once */ - if (initDone) - return; - initDone = TRUE; +void gfxInit(void) +{ + // These must be initialised in the order of their dependancies - /* These must be initialised in the order of their dependancies */ _gosInit(); #if GFX_USE_GMISC _gmiscInit(); @@ -85,3 +88,38 @@ void gfxInit(void) { _gaudoutInit(); #endif } + +void gfxDeinit(void) +{ + // We deinitialise the opposit way as we initialised + + #if GFX_USE_GAUDOUT + _gaudoutDeinit(); + #endif + #if GFX_USE_GAUDIN + _gaoudinDeinit(); + #endif + #if GFX_USE_GADC + _gadcDeinit(); + #endif + #if GFX_USE_GINPUT + _ginputDeinit(); + #endif + #if GFX_USE_GWIN + _gwinDeinit(); + #endif + #if GFX_USE_GDISP + _gdispDeinit(); + #endif + #if GFX_USE_GTIMER + _gtimerDeinit(); + #endif + #if GFX_USE_GEVENT + _geventDeinit(); + #endif + #if GFX_USE_GMISC + _gmiscInit(); + #endif + _gosDeinit(); +} + -- cgit v1.2.3