Landtiger LPC1768 C BigLib
1
A self made, custom C library for the LandTiger board.
Loading...
Searching...
No Matches
glcd_macros.h
Go to the documentation of this file.
1
#ifndef __GLCD_MACROS_H
2
#define __GLCD_MACROS_H
3
4
#include "
glcd_types.h
"
5
6
#include <stdlib.h>
7
#include <string.h>
8
10
#define LCD_OBJECT_DEFINE(...) \
11
(LCD_Obj) \
12
{ \
13
.comps = (LCD_Component[]){__VA_ARGS__}, \
14
.comps_size = sizeof((LCD_Component[]){__VA_ARGS__}) / sizeof(LCD_Component) \
15
}
16
44
#define LCD_OBJECT(id, ...) \
45
LCD_RMAdd(&((LCD_Obj){.comps = (LCD_Component[])__VA_ARGS__, \
46
.comps_size = sizeof((LCD_Component[])__VA_ARGS__) / sizeof(LCD_Component)}), \
47
id, 0);
48
52
#define LCD_INVISIBLE_OBJECT(id, ...) \
53
LCD_RMAdd(&((LCD_Obj){.comps = (LCD_Component[])__VA_ARGS__, \
54
.comps_size = sizeof((LCD_Component[])__VA_ARGS__) / sizeof(LCD_Component)}), \
55
id, LCD_ADD_OBJ_OPT_DONT_MARK_VISIBLE);
56
61
#define LCD_OBJECT_UPDATE_COMMANDS(id, redraw_underneath, ...) \
62
({ \
63
LCD_Error __err = LCD_RMSetVisibility(id, false, redraw_underneath); \
64
if (__err == LCD_ERR_OK) \
65
{ \
66
__VA_ARGS__ \
67
__err = LCD_RMSetVisibility(id, true, false); \
68
} \
69
__err; \
70
})
71
85
#define LCD_RENDER_TMP(...) \
86
LCD_RMRenderTemporary(&(LCD_Obj){.comps = (LCD_Component[])__VA_ARGS__, \
87
.comps_size = sizeof((LCD_Component[])__VA_ARGS__) / sizeof(LCD_Component)})
88
89
// COMPONENTS
90
91
#define LCD_LINE(...) \
92
(LCD_Component) \
93
{ \
94
.type = LCD_COMP_LINE, .object.line = (LCD_Line *)&((LCD_Line)__VA_ARGS__) \
95
}
96
97
#define LCD_RECT(coords, ...) \
98
(LCD_Component) \
99
{ \
100
.type = LCD_COMP_RECT, .pos = coords, .object.rect = (LCD_Rect *)&((LCD_Rect)__VA_ARGS__) \
101
}
102
103
#define LCD_RECT2(x, y, ...) \
104
(LCD_Component) \
105
{ \
106
.type = LCD_COMP_RECT, .pos = (LCD_Coordinate){x, y}, .object.rect = (LCD_Rect *)&((LCD_Rect)__VA_ARGS__) \
107
}
108
109
#define LCD_CIRCLE(...) \
110
(LCD_Component) \
111
{ \
112
.type = LCD_COMP_CIRCLE, .object.circle = (LCD_Circle *)&((LCD_Circle)__VA_ARGS__) \
113
}
114
115
#define LCD_IMAGE(coords, img) \
116
(LCD_Component) \
117
{ \
118
.type = LCD_COMP_IMAGE, .pos = coords, .object.image = (LCD_Image *)&(img) \
119
}
120
121
#define LCD_IMAGE2(x, y, img) \
122
(LCD_Component) \
123
{ \
124
.type = LCD_COMP_IMAGE, .pos = (LCD_Coordinate){x, y}, .object.image = (LCD_Image *)&(img) \
125
}
126
127
#define LCD_TEXT(coords, ...) \
128
(LCD_Component) \
129
{ \
130
.type = LCD_COMP_TEXT, .pos = coords, .object.text = (LCD_Text *)&((LCD_Text)__VA_ARGS__) \
131
}
132
133
#define LCD_TEXT2(x, y, ...) \
134
(LCD_Component) \
135
{ \
136
.type = LCD_COMP_TEXT, .pos = (LCD_Coordinate){x, y}, .object.text = (LCD_Text *)&((LCD_Text)__VA_ARGS__) \
137
}
138
139
// BUTTON
140
141
#define LCD_BUTTON_LABEL(...) (LCD_ButtonLabel) __VA_ARGS__
142
150
#define LCD_BUTTON2(x, y, out_button_area, ...) \
151
((out_button_area = TP_AssignButtonArea((LCD_Button)__VA_ARGS__, (LCD_Coordinate){x, y})), \
152
(LCD_Component){ \
153
.type = LCD_COMP_BUTTON, \
154
.pos = (LCD_Coordinate){x, y}, \
155
.object.button = (LCD_Button *)&((LCD_Button)__VA_ARGS__), \
156
})
157
164
#define LCD_BUTTON(coords, out_button_area, ...) \
165
((out_button_area = TP_AssignButtonArea((LCD_Button)__VA_ARGS__, coords)), \
166
(LCD_Component){ \
167
.type = LCD_COMP_BUTTON, \
168
.pos = coords, \
169
.object.button = (LCD_Button *)&((LCD_Button)__VA_ARGS__), \
170
})
171
172
#endif
glcd_types.h
Keil
Include
Peripherals
glcd_macros.h
Generated by
1.9.8