microui
14.4.1
microui
bsp
ui
inc
ui_log.h
1
/*
2
* Copyright 2024-2025 MicroEJ Corp. All rights reserved.
3
* Use of this source code is governed by a BSD-style license that can be found with this software.
4
*/
5
6
#if !defined UI_LOG_H
7
#define UI_LOG_H
8
9
#ifdef __cplusplus
10
extern
"C"
{
11
#endif
12
13
/*
14
* @brief Provides elements that allow to log some external events in the MicroUI event
15
* group.
16
*
17
* The MicroUI event group is identified by the global LLUI_EVENT_group.
18
*
19
* Notes:
20
* - The first event index is the event 40 (events [0,39] are reserved for MicroUI).
21
* - The number of events is 100 (fixed by MicroUI): [40,139].
22
* - The events [50,59] are reserved to log the buffer refresh strategies (BRS) events.
23
*
24
* Example:
25
*
26
* #include "ui_log.h"
27
* LLTRACE_record_event_u32(LLUI_EVENT_group, MY_EVENT_OFFSET, my_event_data);
28
*
29
* @author MicroEJ Developer Team
30
* @version 14.4.1
31
*/
32
33
// --------------------------------------------------------------------------------
34
// Includes
35
// --------------------------------------------------------------------------------
36
37
/*
38
* @brief Includes right header file according the Architecture.
39
* - Architecture 7: include "trace.h"
40
* - Architecture 8: include "LLTRACE.h"
41
*/
42
#if !defined UI_LOG_LLTRACE
43
#if !defined __has_include
44
#error "Set manually UI_LOG_LLTRACE: 0 for MicroEJ Architecture 7.x or 1 for MicroEJ Architecture 8.x"
45
#else
46
#define UI_LOG_LLTRACE __has_include("LLTRACE.h"
)
47
#endif
// #if !defined __has_include
48
#endif
// #if !defined UI_LOG_LLTRACE
49
#if UI_LOG_LLTRACE == (0u)
50
#include <trace.h>
51
#else
52
#include <LLTRACE.h>
53
#endif
54
55
// --------------------------------------------------------------------------------
56
// Defines
57
// --------------------------------------------------------------------------------
58
59
/*
60
* @brief Useful macros to concatenate easily some strings and defines.
61
*/
62
#ifndef CONCAT
63
#define CONCAT0(p, s) p ## s
64
#define CONCAT(p, s) CONCAT0(p, s)
65
#endif
66
67
/*
68
* @brief Macros to count the number of arguments of a log (maximum 10)
69
*/
70
#define UI_LOG_COUNT_ARGS0(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, Pn, ...) Pn
71
#define UI_LOG_COUNT_ARGS(...) UI_LOG_COUNT_ARGS0(-1, ## __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
72
73
/*
74
* @brief Identifies the logs for the Buffer Refresh Strategies (BRS).
75
*/
76
#define UI_LOG_BRS_FlushSingle 51
77
#define UI_LOG_BRS_FlushMulti 52
78
#define UI_LOG_BRS_RestoreRegion 57
79
80
/*
81
* @brief Identifies the logs related to the clip and drawings
82
*/
83
#define UI_LOG_OutOfClip 67
84
#define UI_LOG_DrawnRegion 68
85
86
/*
87
* @brief Identifies the logs used by LLUI_PAINTER_impl.c
88
*/
89
#define UI_LOG_stringWidth 62
90
#define UI_LOG_writePixel 80
91
#define UI_LOG_drawLine 81
92
#define UI_LOG_drawHorizontalLine 82
93
#define UI_LOG_drawVerticalLine 83
94
#define UI_LOG_drawRectangle 84
95
#define UI_LOG_fillRectangle 85
96
#define UI_LOG_drawRoundedRectangle 86
97
#define UI_LOG_fillRoundedRectangle 87
98
#define UI_LOG_drawCircleArc 88
99
#define UI_LOG_fillCircleArc 89
100
#define UI_LOG_drawEllipseArc 90
101
#define UI_LOG_fillEllipseArc 91
102
#define UI_LOG_drawEllipse 92
103
#define UI_LOG_fillEllipse 93
104
#define UI_LOG_drawCircle 94
105
#define UI_LOG_fillCircle 95
106
#define UI_LOG_drawImage 96
107
#define UI_LOG_drawString 97
108
#define UI_LOG_drawRenderableString 98
109
110
/*
111
* @brief Identifies the logs used by LLDW_PAINTER_impl.c
112
*/
113
#define UI_LOG_Bilinear 0
114
#define UI_LOG_NearestNeighbor 1
115
#define UI_LOG_drawThickFadedPoint 70
116
#define UI_LOG_drawThickFadedLine 71
117
#define UI_LOG_drawThickFadedCircle 72
118
#define UI_LOG_drawThickFadedCircleArc 73
119
#define UI_LOG_drawThickFadedEllipse 74
120
#define UI_LOG_drawThickLine 75
121
#define UI_LOG_drawThickCircle 76
122
#define UI_LOG_drawThickEllipse 77
123
#define UI_LOG_drawThickCircleArc 78
124
#define UI_LOG_drawFlippedImage 90
125
#define UI_LOG_drawRotatedImage 91
126
#define UI_LOG_drawScaledImage 92
127
#define UI_LOG_drawScaledString 93
128
#define UI_LOG_drawScaledRenderableString 94
129
#define UI_LOG_drawRotatedCharacter 95
130
131
/*
132
* @brief Compatibility of Architecture 7 with Architecture 8: use the prototypes
133
* of LLTRACE.h (Architecture 8).
134
*/
135
#if UI_LOG_LLTRACE == (0u)
136
#define LLTRACE_record_event_void TRACE_record_event_void
137
#define LLTRACE_record_event_u32 TRACE_record_event_u32
138
#define LLTRACE_record_event_u32x2 TRACE_record_event_u32x2
139
#define LLTRACE_record_event_u32x3 TRACE_record_event_u32x3
140
#define LLTRACE_record_event_u32x4 TRACE_record_event_u32x4
141
#define LLTRACE_record_event_u32x5 TRACE_record_event_u32x5
142
#define LLTRACE_record_event_u32x6 TRACE_record_event_u32x6
143
#define LLTRACE_record_event_u32x7 TRACE_record_event_u32x7
144
#define LLTRACE_record_event_u32x8 TRACE_record_event_u32x8
145
#define LLTRACE_record_event_u32x9 TRACE_record_event_u32x9
146
#define LLTRACE_record_event_u32x10 TRACE_record_event_u32x10
147
#define LLTRACE_record_event_end TRACE_record_event_end
148
#define LLTRACE_record_event_end_u32 TRACE_record_event_end_u32
149
#endif
// if UI_LOG_LLTRACE == (0u)
150
151
/*
152
* @brief Macros to call the log functions
153
*/
154
#define LLTRACE_record_event_u32x1 LLTRACE_record_event_u32
155
#define UI_LOG_FUNCTION(...) CONCAT(LLTRACE_record_event_u32x, UI_LOG_COUNT_ARGS(__VA_ARGS__))
156
#define UI_LOG_OFFSET(fn) CONCAT(UI_LOG_, fn)
157
#define UI_LOG_PARAMS(fn, ...) LLUI_EVENT_group, UI_LOG_OFFSET(fn), __VA_ARGS__
158
159
/*
160
* @brief Add the image's buffer address as a log
161
*/
162
#define UI_LOG_BUFFER(img) (uint32_t)LLUI_DISPLAY_getBufferAddress(img)
163
164
/*
165
* @brief Starts a UI log (at least one parameter is required)
166
*/
167
#define UI_LOG_START(fn, ...) UI_LOG_FUNCTION(__VA_ARGS__)(UI_LOG_PARAMS(fn, __VA_ARGS__))
168
169
/*
170
* @brief Ends a UI log (one parameter is required)
171
*/
172
#define UI_LOG_END(fn, v) LLTRACE_record_event_end_u32(UI_LOG_PARAMS(fn, v))
173
174
/*
175
* @brief Starts a UI log that denotes a drawing (destination "gc" is required)
176
*/
177
#define UI_LOG_DRAW_START(fn, gc, ...) UI_LOG_START(fn, UI_LOG_BUFFER(&gc->image), __VA_ARGS__)
178
179
/*
180
* @brief Ends a UI log that denotes a drawing
181
*/
182
#define UI_LOG_DRAW_END UI_LOG_END
183
184
// --------------------------------------------------------------------------------
185
// Fields
186
// --------------------------------------------------------------------------------
187
188
/*
189
* @brief Identifies the MicroUI group to log an event.
190
*/
191
extern
int32_t LLUI_EVENT_group;
192
193
// --------------------------------------------------------------------------------
194
// EOF
195
// --------------------------------------------------------------------------------
196
197
#ifdef __cplusplus
198
}
199
#endif
200
201
#endif
// UI_LOG_H
Generated by
1.9.1