Embedded SDK
Embedded SDK
nbgl_debug.h
Go to the documentation of this file.
1 
7 #ifndef NBGL_DEBUG_H
8 #define NBGL_DEBUG_H
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 // #define WITH_STDIO 1
15 
16 /*********************
17  * INCLUDES
18  *********************/
19 #ifdef WITH_STDIO
20 #include <stdio.h>
21 #include <stdlib.h>
22 #endif
23 
24 /*********************
25  * DEFINES
26  *********************/
27 enum {
42 };
43 /**********************
44  * TYPEDEFS
45  **********************/
46 
47 /**********************
48  * GLOBAL PROTOTYPES
49  **********************/
50 extern unsigned long gLogger;
51 
52 /**********************
53  * MACROS
54  **********************/
55 #ifdef WITH_STDIO
56 extern void mainExit(int exitCode);
57 #define LOG_DEBUG(__logger, ...) \
58  { \
59  if (gLogger & (1 << __logger)) \
60  printf(__VA_ARGS__); \
61  }
62 #define LOG_WARN(__logger, ...) printf(__VA_ARGS__)
63 #define LOG_FATAL(__logger, ...) \
64  { \
65  printf(__VA_ARGS__); \
66  mainExit(-1); \
67  }
68 
69 #else // WITH_STDIO
70 #ifdef NBGL_DEBUG
71 #include <os.h>
72 #define LOG_DEBUG(__logger, ...) \
73  do { \
74  PRINTF(__VA_ARGS__); \
75  } while (0)
76 #define LOG_WARN(__logger, ...) \
77  do { \
78  PRINTF(__VA_ARGS__); \
79  } while (0)
80 #define LOG_FATAL(__logger, ...) \
81  do { \
82  PRINTF(__VA_ARGS__); \
83  halt(); \
84  } while (0)
85 #else
86 #define LOG_DEBUG(__logger, ...)
87 #define LOG_WARN(__logger, ...)
88 #define LOG_FATAL(__logger, ...)
89 #endif // NBGL_DEBUG
90 #endif // WITH_STDIO
91 
92 #ifdef __cplusplus
93 } /* extern "C" */
94 #endif
95 
96 #endif /* NBGL_DEBUG_H */
unsigned long gLogger
@ FLOW_LOGGER
Definition: nbgl_debug.h:41
@ SCREEN_LOGGER
Definition: nbgl_debug.h:32
@ LAYOUT_LOGGER
Definition: nbgl_debug.h:33
@ OBJ_LOGGER
Definition: nbgl_debug.h:30
@ USE_CASE_LOGGER
Definition: nbgl_debug.h:35
@ APP_LOGGER
Definition: nbgl_debug.h:37
@ STEP_LOGGER
Definition: nbgl_debug.h:40
@ PAGE_LOGGER
Definition: nbgl_debug.h:34
@ LOW_LOGGER
Definition: nbgl_debug.h:28
@ UX_LOGGER
Definition: nbgl_debug.h:38
@ DRAW_LOGGER
Definition: nbgl_debug.h:29
@ MISC_LOGGER
Definition: nbgl_debug.h:39
@ OBJ_POOL_LOGGER
Definition: nbgl_debug.h:31
@ TOUCH_LOGGER
Definition: nbgl_debug.h:36