The official µGFX library repository.

gfx.h 7.1KB

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