Landtiger LPC1768 C BigLib 1
A self made, custom C library for the LandTiger board.
 
Loading...
Searching...
No Matches
glcd_macros.h File Reference
#include "glcd_types.h"
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Macros

#define LCD_OBJECT_DEFINE(...)
 Defines an object without adding it to the LCD render list.
 
#define LCD_OBJECT(id, ...)
 
#define LCD_INVISIBLE_OBJECT(id, ...)
 Same as LCD_OBJECT(), but it asks the GLCD to NOT make the object immediately visible. Objects like these won't be rendered simply by calling LCD_RMRender(), but they first need to have their visibility manually set to true by the user, through the LCD_RMSetVisibility() function.
 
#define LCD_OBJECT_UPDATE_COMMANDS(id, redraw_underneath, ...)
 Updates an object with the specified ID, by removing it from the list, updating it, and then adding it back.
 
#define LCD_RENDER_TMP(...)
 
#define LCD_LINE(...)
 
#define LCD_RECT(coords, ...)
 
#define LCD_RECT2(x, y, ...)
 
#define LCD_CIRCLE(...)
 
#define LCD_IMAGE(coords, img)
 
#define LCD_IMAGE2(x, y, img)
 
#define LCD_TEXT(coords, ...)
 
#define LCD_TEXT2(x, y, ...)
 
#define LCD_BUTTON_LABEL(...)   (LCD_ButtonLabel) __VA_ARGS__
 
#define LCD_BUTTON2(x, y, out_button_area, ...)
 Creates a button component.
 
#define LCD_BUTTON(coords, out_button_area, ...)
 Creates a button component.
 

Macro Definition Documentation

◆ LCD_BUTTON

#define LCD_BUTTON (   coords,
  out_button_area,
  ... 
)
Value:
((out_button_area = TP_AssignButtonArea((LCD_Button)__VA_ARGS__, coords)), \
.type = LCD_COMP_BUTTON, \
.pos = coords, \
.object.button = (LCD_Button *)&((LCD_Button)__VA_ARGS__), \
})
@ LCD_COMP_BUTTON
Definition glcd_types.h:163
Used to store a drawable component of any type.
Definition glcd_types.h:168
TP_ButtonArea TP_AssignButtonArea(LCD_Button button, LCD_Coordinate pos)
Assigns a button area to the given button.
Definition touch.c:436

Creates a button component.

Parameters
coordsThe position of the button.
...The initializers for the button component.
Returns
A TP_ButtonArea component, mapped to the position & size of the button, so that it can be used with the touch panel, to detect button presses.
Note
Use the LCD_BUTTON_LABEL macro to initialize the label field, not the text field.

Definition at line 164 of file glcd_macros.h.

166 { \
167 .type = LCD_COMP_BUTTON, \
168 .pos = coords, \
169 .object.button = (LCD_Button *)&((LCD_Button)__VA_ARGS__), \
170 })

◆ LCD_BUTTON2

#define LCD_BUTTON2 (   x,
  y,
  out_button_area,
  ... 
)
Value:
((out_button_area = TP_AssignButtonArea((LCD_Button)__VA_ARGS__, (LCD_Coordinate){x, y})), \
.type = LCD_COMP_BUTTON, \
.pos = (LCD_Coordinate){x, y}, \
.object.button = (LCD_Button *)&((LCD_Button)__VA_ARGS__), \
})

Creates a button component.

Parameters
xThe x-coordinate of the button.
yThe y-coordinate of the button.
...The initializers for the button component.
Returns
A TP_ButtonArea component, mapped to the position & size of the button, so that it can be used with the touch panel, to detect button presses.
Note
Use the LCD_BUTTON_LABEL macro to initialize the label field, not the text field.

Definition at line 150 of file glcd_macros.h.

151 {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 })

◆ LCD_BUTTON_LABEL

#define LCD_BUTTON_LABEL (   ...)    (LCD_ButtonLabel) __VA_ARGS__

Definition at line 141 of file glcd_macros.h.

◆ LCD_CIRCLE

#define LCD_CIRCLE (   ...)
Value:
{ \
.type = LCD_COMP_CIRCLE, .object.circle = (LCD_Circle *)&((LCD_Circle)__VA_ARGS__) \
}
@ LCD_COMP_CIRCLE
Definition glcd_types.h:160

Definition at line 109 of file glcd_macros.h.

111 { \
112 .type = LCD_COMP_CIRCLE, .object.circle = (LCD_Circle *)&((LCD_Circle)__VA_ARGS__) \
113 }

◆ LCD_IMAGE

#define LCD_IMAGE (   coords,
  img 
)
Value:
{ \
.type = LCD_COMP_IMAGE, .pos = coords, .object.image = (LCD_Image *)&(img) \
}
@ LCD_COMP_IMAGE
Definition glcd_types.h:161

Definition at line 115 of file glcd_macros.h.

117 { \
118 .type = LCD_COMP_IMAGE, .pos = coords, .object.image = (LCD_Image *)&(img) \
119 }

◆ LCD_IMAGE2

#define LCD_IMAGE2 (   x,
  y,
  img 
)
Value:
{ \
.type = LCD_COMP_IMAGE, .pos = (LCD_Coordinate){x, y}, .object.image = (LCD_Image *)&(img) \
}

Definition at line 121 of file glcd_macros.h.

123 { \
124 .type = LCD_COMP_IMAGE, .pos = (LCD_Coordinate){x, y}, .object.image = (LCD_Image *)&(img) \
125 }

◆ LCD_INVISIBLE_OBJECT

#define LCD_INVISIBLE_OBJECT (   id,
  ... 
)
Value:
LCD_RMAdd(&((LCD_Obj){.comps = (LCD_Component[])__VA_ARGS__, \
.comps_size = sizeof((LCD_Component[])__VA_ARGS__) / sizeof(LCD_Component)}), \
LCD_Error LCD_RMAdd(LCD_Obj *const obj, LCD_ObjID *out_id, u8 options)
Adds a new object to the render list, and returns its ID (if out_id is not NULL) through the out_id p...
Definition glcd.c:292
@ LCD_ADD_OBJ_OPT_DONT_MARK_VISIBLE
Request GLCD to not mark the newly added object as visible. In that way, it it won't be rendered by a...
Definition glcd_types.h:204
Represents a generic object, made up of 1 or more basic components, that are rendered on the screen.
Definition glcd_types.h:189

Same as LCD_OBJECT(), but it asks the GLCD to NOT make the object immediately visible. Objects like these won't be rendered simply by calling LCD_RMRender(), but they first need to have their visibility manually set to true by the user, through the LCD_RMSetVisibility() function.

Definition at line 52 of file glcd_macros.h.

53 {.comps = (LCD_Component[])__VA_ARGS__, \
54 .comps_size = sizeof((LCD_Component[])__VA_ARGS__) / sizeof(LCD_Component)}), \

◆ LCD_LINE

#define LCD_LINE (   ...)
Value:
{ \
.type = LCD_COMP_LINE, .object.line = (LCD_Line *)&((LCD_Line)__VA_ARGS__) \
}
@ LCD_COMP_LINE
Definition glcd_types.h:158

Definition at line 91 of file glcd_macros.h.

93 { \
94 .type = LCD_COMP_LINE, .object.line = (LCD_Line *)&((LCD_Line)__VA_ARGS__) \
95 }

◆ LCD_OBJECT

#define LCD_OBJECT (   id,
  ... 
)
Value:
LCD_RMAdd(&((LCD_Obj){.comps = (LCD_Component[])__VA_ARGS__, \
.comps_size = sizeof((LCD_Component[])__VA_ARGS__) / sizeof(LCD_Component)}), \
id, 0);

Definition at line 44 of file glcd_macros.h.

45 {.comps = (LCD_Component[])__VA_ARGS__, \
46 .comps_size = sizeof((LCD_Component[])__VA_ARGS__) / sizeof(LCD_Component)}), \
47 id, 0);

◆ LCD_OBJECT_DEFINE

#define LCD_OBJECT_DEFINE (   ...)
Value:
(LCD_Obj) \
{ \
.comps = (LCD_Component[]){__VA_ARGS__}, \
.comps_size = sizeof((LCD_Component[]){__VA_ARGS__}) / sizeof(LCD_Component) \
}

Defines an object without adding it to the LCD render list.

Definition at line 10 of file glcd_macros.h.

12 { \
13 .comps = (LCD_Component[]){__VA_ARGS__}, \
14 .comps_size = sizeof((LCD_Component[]){__VA_ARGS__}) / sizeof(LCD_Component) \
15 }

◆ LCD_OBJECT_UPDATE_COMMANDS

#define LCD_OBJECT_UPDATE_COMMANDS (   id,
  redraw_underneath,
  ... 
)
Value:
({ \
LCD_Error __err = LCD_RMSetVisibility(id, false, redraw_underneath); \
if (__err == LCD_ERR_OK) \
{ \
__VA_ARGS__ \
__err = LCD_RMSetVisibility(id, true, false); \
} \
__err; \
})
LCD_Error LCD_RMSetVisibility(LCD_ObjID id, bool visible, bool redraw_underneath)
Shows/hides an object on/from the screen without modifying the render list.
Definition glcd.c:449
LCD_Error
Error codes returned by the GLCD library.
Definition glcd_errors.h:6
@ LCD_ERR_OK
No error occurred.
Definition glcd_errors.h:8

Updates an object with the specified ID, by removing it from the list, updating it, and then adding it back.

Parameters
idThe ID of the object to update.
redraw_underneathWhether to redraw the objects that are below the updated object.
...A series of operation that will be performed on the object.

Definition at line 61 of file glcd_macros.h.

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 })

◆ LCD_RECT

#define LCD_RECT (   coords,
  ... 
)
Value:
{ \
.type = LCD_COMP_RECT, .pos = coords, .object.rect = (LCD_Rect *)&((LCD_Rect)__VA_ARGS__) \
}
@ LCD_COMP_RECT
Definition glcd_types.h:159

Definition at line 97 of file glcd_macros.h.

99 { \
100 .type = LCD_COMP_RECT, .pos = coords, .object.rect = (LCD_Rect *)&((LCD_Rect)__VA_ARGS__) \
101 }

◆ LCD_RECT2

#define LCD_RECT2 (   x,
  y,
  ... 
)
Value:
{ \
.type = LCD_COMP_RECT, .pos = (LCD_Coordinate){x, y}, .object.rect = (LCD_Rect *)&((LCD_Rect)__VA_ARGS__) \
}

Definition at line 103 of file glcd_macros.h.

105 { \
106 .type = LCD_COMP_RECT, .pos = (LCD_Coordinate){x, y}, .object.rect = (LCD_Rect *)&((LCD_Rect)__VA_ARGS__) \
107 }

◆ LCD_RENDER_TMP

#define LCD_RENDER_TMP (   ...)
Value:
LCD_RMRenderTemporary(&(LCD_Obj){.comps = (LCD_Component[])__VA_ARGS__, \
.comps_size = sizeof((LCD_Component[])__VA_ARGS__) / sizeof(LCD_Component)})
LCD_Error LCD_RMRenderTemporary(LCD_Obj *const obj)
Renders the object immediately, without adding neither to the render list nor to the memory arena....
Definition glcd.c:438

Definition at line 85 of file glcd_macros.h.

86 {.comps = (LCD_Component[])__VA_ARGS__, \
87 .comps_size = sizeof((LCD_Component[])__VA_ARGS__) / sizeof(LCD_Component)})

◆ LCD_TEXT

#define LCD_TEXT (   coords,
  ... 
)
Value:
{ \
.type = LCD_COMP_TEXT, .pos = coords, .object.text = (LCD_Text *)&((LCD_Text)__VA_ARGS__) \
}
@ LCD_COMP_TEXT
Definition glcd_types.h:162

Definition at line 127 of file glcd_macros.h.

129 { \
130 .type = LCD_COMP_TEXT, .pos = coords, .object.text = (LCD_Text *)&((LCD_Text)__VA_ARGS__) \
131 }

◆ LCD_TEXT2

#define LCD_TEXT2 (   x,
  y,
  ... 
)
Value:
{ \
.type = LCD_COMP_TEXT, .pos = (LCD_Coordinate){x, y}, .object.text = (LCD_Text *)&((LCD_Text)__VA_ARGS__) \
}

Definition at line 133 of file glcd_macros.h.

135 { \
136 .type = LCD_COMP_TEXT, .pos = (LCD_Coordinate){x, y}, .object.text = (LCD_Text *)&((LCD_Text)__VA_ARGS__) \
137 }