version 2.8
gfx.h
Go to the documentation of this file.
1 /*
2  * This file is subject to the terms of the GFX License. If a copy of
3  * the license was not distributed with this file, you can obtain one at:
4  *
5  * http://ugfx.org/license.html
6  */
7 
8 /**
9  * @file gfx.h
10  * @brief GFX system header file.
11  *
12  * @addtogroup GFX
13  *
14  * @brief Main module to glue all the others together
15  *
16  * @{
17  */
18 
19 #ifndef _GFX_H
20 #define _GFX_H
21 
22 /**
23  * These two definitions below are required before anything else so that we can
24  * turn module definitions off and on.
25  */
26 
27 /**
28  * @brief Generic 'false' boolean constant.
29  */
30 #if !defined(FALSE) || defined(__DOXYGEN__)
31  #define FALSE 0
32 #endif
33 
34 /**
35  * @brief Generic 'true' boolean constant.
36  */
37 #if !defined(TRUE) || defined(__DOXYGEN__)
38  #define TRUE -1
39 #endif
40 
41 // Macro concatination and strify - not API documented
42 #define GFXCATX(a, b) GFXCAT(a, b)
43 #define GFXCAT(a, b) a ## b
44 #define GFXSTRX(a) GFXSTR(a)
45 #define GFXSTR(a) #a
46 
47 /* gfxconf.h is the user's project configuration for the GFX system. */
48 #include "gfxconf.h"
49 
50 /* Include Compiler and CPU support */
51 #include "src/gfx_compilers.h"
52 
53 /**
54  * @name GFX sub-systems that can be turned on
55  * @{
56  */
57  /**
58  * @brief GFX Driver API
59  * @details Defaults to TRUE
60  * @note Not much useful can be done without a driver
61  */
62  #ifndef GFX_USE_GDRIVER
63  #define GFX_USE_GDRIVER TRUE
64  #endif
65  /**
66  * @brief GFX Graphics Display Basic API
67  * @details Defaults to FALSE
68  * @note Also add the specific hardware driver to your makefile.
69  * Eg. include $(GFXLIB)/drivers/gdisp/Nokia6610/driver.mk
70  */
71  #ifndef GFX_USE_GDISP
72  #define GFX_USE_GDISP FALSE
73  #endif
74  /**
75  * @brief GFX Graphics Windowing API
76  * @details Defaults to FALSE
77  * @details Extends the GDISP API to add the concept of graphic windows.
78  * @note Also supports high-level "window" objects such as console windows,
79  * buttons, graphing etc
80  */
81  #ifndef GFX_USE_GWIN
82  #define GFX_USE_GWIN FALSE
83  #endif
84  /**
85  * @brief GFX Event API
86  * @details Defaults to FALSE
87  * @details Defines the concept of a "Source" that can send "Events" to "Listeners".
88  */
89  #ifndef GFX_USE_GEVENT
90  #define GFX_USE_GEVENT FALSE
91  #endif
92  /**
93  * @brief GFX Timer API
94  * @details Defaults to FALSE
95  * @details Provides thread context timers - both one-shot and periodic.
96  */
97  #ifndef GFX_USE_GTIMER
98  #define GFX_USE_GTIMER FALSE
99  #endif
100  /**
101  * @brief GFX Queue API
102  * @details Defaults to FALSE
103  * @details Provides queue management.
104  */
105  #ifndef GFX_USE_GQUEUE
106  #define GFX_USE_GQUEUE FALSE
107  #endif
108  /**
109  * @brief GFX Input Device API
110  * @details Defaults to FALSE
111  * @note Also add the specific hardware drivers to your makefile.
112  * Eg.
113  * include $(GFXLIB)/drivers/ginput/toggle/Pal/driver.mk
114  * and...
115  * include $(GFXLIB)/drivers/ginput/touch/MCU/driver.mk
116  */
117  #ifndef GFX_USE_GINPUT
118  #define GFX_USE_GINPUT FALSE
119  #endif
120  /**
121  * @brief GFX Generic Periodic ADC API
122  * @details Defaults to FALSE
123  */
124  #ifndef GFX_USE_GADC
125  #define GFX_USE_GADC FALSE
126  #endif
127  /**
128  * @brief GFX Audio API
129  * @details Defaults to FALSE
130  * @note Also add the specific hardware drivers to your makefile.
131  * Eg.
132  * include $(GFXLIB)/drivers/gaudio/GADC/driver.mk
133  */
134  #ifndef GFX_USE_GAUDIO
135  #define GFX_USE_GAUDIO FALSE
136  #endif
137  /**
138  * @brief GFX Miscellaneous Routines API
139  * @details Defaults to FALSE
140  * @note Turning this on without turning on any GMISC_NEED_xxx macros will result
141  * in no extra code being compiled in. GMISC is made up from the sum of its
142  * parts.
143  */
144  #ifndef GFX_USE_GMISC
145  #define GFX_USE_GMISC FALSE
146  #endif
147  /**
148  * @brief GFX File API
149  * @details Defaults to FALSE
150  */
151  #ifndef GFX_USE_GFILE
152  #define GFX_USE_GFILE FALSE
153  #endif
154  /**
155  * @brief GFX Translation Support API
156  * @details Defaults to FALSE
157  */
158  #ifndef GFX_USE_GTRANS
159  #define GFX_USE_GTRANS FALSE
160  #endif
161 /** @} */
162 
163 /**
164  * Get all the options for each sub-system.
165  *
166  */
167 #include "src/gos/gos_options.h"
169 #include "src/gfile/gfile_options.h"
170 #include "src/gmisc/gmisc_options.h"
175 #include "src/gdisp/gdisp_options.h"
176 #include "src/gwin/gwin_options.h"
178 #include "src/gadc/gadc_options.h"
180 
181 /**
182  * Interdependency safety checks on the sub-systems.
183  * These must be in dependency order.
184  *
185  */
186 #ifndef GFX_DISPLAY_RULE_WARNINGS
187  #define GFX_DISPLAY_RULE_WARNINGS FALSE
188 #endif
189 #include "src/gwin/gwin_rules.h"
190 #include "src/ginput/ginput_rules.h"
191 #include "src/gdisp/gdisp_rules.h"
192 #include "src/gaudio/gaudio_rules.h"
193 #include "src/gadc/gadc_rules.h"
194 #include "src/gevent/gevent_rules.h"
195 #include "src/gtimer/gtimer_rules.h"
196 #include "src/gqueue/gqueue_rules.h"
197 #include "src/gmisc/gmisc_rules.h"
198 #include "src/gtrans/gtrans_rules.h"
199 #include "src/gfile/gfile_rules.h"
201 #include "src/gos/gos_rules.h"
202 
203 /**
204  * Include the sub-system header files
205  */
206 #include "src/gos/gos.h"
207 //#include "src/gdriver/gdriver.h" // This module is only included by source that needs it.
208 #include "src/gfile/gfile.h"
209 #include "src/gmisc/gmisc.h"
210 #include "src/gtrans/gtrans.h"
211 #include "src/gqueue/gqueue.h"
212 #include "src/gevent/gevent.h"
213 #include "src/gtimer/gtimer.h"
214 #include "src/gdisp/gdisp.h"
215 #include "src/gwin/gwin.h"
216 #include "src/ginput/ginput.h"
217 #include "src/gadc/gadc.h"
218 #include "src/gaudio/gaudio.h"
219 
220 #ifdef __cplusplus
221 extern "C" {
222 #endif
223 
224  /**
225  * @brief The one call to start it all
226  *
227  * @note This will initialise each sub-system that has been turned on.
228  * For example, if GFX_USE_GDISP is defined then display will be initialised
229  * and cleared to black.
230  * @note If you define GFX_OS_NO_INIT as TRUE in your gfxconf.h file then ugfx doesn't try to
231  * initialise the operating system for you when you call @p gfxInit().
232  * @note If you define GFX_OS_EXTRA_INIT_FUNCTION in your gfxconf.h file the macro is the
233  * name of a void function with no parameters that is called immediately after
234  * operating system initialisation (whether or not GFX_OS_NO_INIT is set).
235  * @note If you define GFX_OS_EXTRA_DEINIT_FUNCTION in your gfxconf.h file the macro is the
236  * name of a void function with no parameters that is called immediately before
237  * operating system de-initialisation (as ugfx is exiting).
238  * @note If GFX_OS_CALL_UGFXMAIN is set uGFXMain() is called after all initialisation is complete.
239  *
240  * @api
241  */
242  void gfxInit(void);
243 
244  /**
245  * @brief The one call to end it all
246  *
247  * @note This will de-initialise each sub-system that has been turned on.
248  *
249  * @api
250  */
251  void gfxDeinit(void);
252 
253  #if GFX_OS_CALL_UGFXMAIN || defined(__DOXYGEN__)
254  /**
255  * @brief The function containing all the user uGFX application code.
256  *
257  * @note This is called by gfxInit() and is expected to never return.
258  * It is defined by the user.
259  *
260  * @pre GFX_OS_CALL_UGFXMAIN is GFXON
261  */
262  void uGFXMain(void);
263  #endif
264 #ifdef __cplusplus
265 }
266 #endif
267 
268 #endif /* _GFX_H */
269 /** @} */
270 
GWIN sub-system options header file.
GQUEUE safety rules header file.
GAUDIO - Audio subsystem options header file.
GFILE - File IO options header file.
void gfxDeinit(void)
The one call to end it all.
Definition: gfx.c:140
void gfxInit(void)
The one call to start it all.
Definition: gfx.c:82
GMISC - Miscellaneous Routines header file.
GWIN safety rules header file.
GMISC safety rules header file.
GDRIVER - Driver options header file.
GTIMER sub-system options header file.
GFILE safety rules header file.
GDISP Graphic Driver subsystem header file.
GMISC - Miscellaneous Routines options header file.
GQUEUE - Queue options header file.
GDISP safety rules header file.
GFILE - File IO Routines header file.
GQUEUE header file.
GTIMER safety rules header file.
GADC - Periodic ADC subsystem options header file.
GDISP sub-system options header file.
GADC safety rules header file.
void uGFXMain(void)
The function containing all the user uGFX application code.
GOS safety rules header file.
GEVENT safety rules header file.
GINPUT sub-system options header file.
GEVENT sub-system options header file.
GAUDIO safety rules header file.
GFX compiler support header file.
GOS - Operating System Support header file.
GDRIVER safety rules header file.
GOS - Operating System options header file.
GINPUT safety rules header file.