Embedded SDK
Embedded SDK
lib_nbgl
include
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
{
28
LOW_LOGGER
,
29
DRAW_LOGGER
,
30
OBJ_LOGGER
,
31
OBJ_POOL_LOGGER
,
32
SCREEN_LOGGER
,
33
LAYOUT_LOGGER
,
34
PAGE_LOGGER
,
35
USE_CASE_LOGGER
,
36
TOUCH_LOGGER
,
37
APP_LOGGER
,
38
UX_LOGGER
,
39
MISC_LOGGER
,
40
STEP_LOGGER
,
41
FLOW_LOGGER
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 */
gLogger
unsigned long gLogger
FLOW_LOGGER
@ FLOW_LOGGER
Definition:
nbgl_debug.h:41
SCREEN_LOGGER
@ SCREEN_LOGGER
Definition:
nbgl_debug.h:32
LAYOUT_LOGGER
@ LAYOUT_LOGGER
Definition:
nbgl_debug.h:33
OBJ_LOGGER
@ OBJ_LOGGER
Definition:
nbgl_debug.h:30
USE_CASE_LOGGER
@ USE_CASE_LOGGER
Definition:
nbgl_debug.h:35
APP_LOGGER
@ APP_LOGGER
Definition:
nbgl_debug.h:37
STEP_LOGGER
@ STEP_LOGGER
Definition:
nbgl_debug.h:40
PAGE_LOGGER
@ PAGE_LOGGER
Definition:
nbgl_debug.h:34
LOW_LOGGER
@ LOW_LOGGER
Definition:
nbgl_debug.h:28
UX_LOGGER
@ UX_LOGGER
Definition:
nbgl_debug.h:38
DRAW_LOGGER
@ DRAW_LOGGER
Definition:
nbgl_debug.h:29
MISC_LOGGER
@ MISC_LOGGER
Definition:
nbgl_debug.h:39
OBJ_POOL_LOGGER
@ OBJ_POOL_LOGGER
Definition:
nbgl_debug.h:31
TOUCH_LOGGER
@ TOUCH_LOGGER
Definition:
nbgl_debug.h:36
Generated by
1.9.1