MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_common.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
3 *
4 * Subject to your compliance with these terms, you may use Microchip software
5 * and any derivatives exclusively with Microchip products. It is your
6 * responsibility to comply with third party license terms applicable to your
7 * use of third party software (including open source software) that may
8 * accompany Microchip software.
9 *
10 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
11 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
12 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
13 * PARTICULAR PURPOSE.
14 *
15 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
16 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
17 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
18 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
19 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
20 * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
21 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
22 *******************************************************************************/
23 
24 /*******************************************************************************
25  Module for Microchip Graphics Library - Legato User Interface Library
26 
27  Company:
28  Microchip Technology Inc.
29 
30  File Name:
31  legato_common.h
32 
33  Summary:
34  This file defines the common macros and definitions used by the gfx
35  definition and implementation headers.
36 
37  Description:
38  This file defines the common macros and definitions used by the gfx
39  definition and the implementation header.
40 
41  Remarks:
42  The directory in which this file resides should be added to the compiler's
43  search path for header files.
44  *******************************************************************************/
45 
56 #ifndef LEGATO_COMMON_H
57 #define LEGATO_COMMON_H
58 
59 #include "gfx/legato/legato_config.h"
60 
61 #include <stddef.h>
62 #include <assert.h>
63 #include <string.h>
64 
65 #ifdef _WIN32
66 #ifndef int8_t
67 typedef signed __int8 int8_t;
68 typedef signed __int16 int16_t;
69 typedef signed __int32 int32_t;
70 typedef unsigned __int8 uint8_t;
71 typedef unsigned __int16 uint16_t;
72 typedef unsigned __int32 uint32_t;
73 typedef signed __int64 int64_t;
74 typedef unsigned __int64 uint64_t;
75 #endif
76 #else
77 #include <stdint.h>
78 #endif
79 
80 #ifndef WIN32
81 //#include "osal/osal.h" FIXME for H3
82 #endif
83 
89 #ifndef LE_DEFAULT_SCHEME_COLOR_MODE
90 #define LE_DEFAULT_SCHEME_COLOR_MODE LE_COLOR_MODE_RGB_565
91 #endif
92 
93 #ifdef __cplusplus
94  extern "C" {
95 #endif
96 
97 
98 // *****************************************************************************
99 // *****************************************************************************
100 // Section: Data Types and Constants
101 // *****************************************************************************
102 // *****************************************************************************
103 
104 // *****************************************************************************
105 /* Enumeration:
106  leResult
107 
108  Summary:
109  legato results (success and failure codes).
110 
111  Description:
112  Various definitions for success and failure codes.
113 
114  Remarks:
115  None.
116 */
117 
123 typedef enum leResult
124 {
125  LE_FAILURE = -1,
126  LE_SUCCESS = 0
127 } leResult;
128 
129 // *****************************************************************************
130 /* Enumeration:
131  leBool
132 
133  Summary:
134  legato bool values
135 
136  Description:
137  legato bool values
138 
139  Remarks:
140  None.
141 */
146 typedef enum leBool
147 {
148  LE_FALSE = 0,
150 } leBool;
151 
152 // *****************************************************************************
153 /* Enumeration:
154  leVAlignment
155 
156  Summary:
157  legato vertical alignment values
158 
159  Description:
160  legato vertical alignment values
161 
162  Remarks:
163  None.
164 */
170 typedef enum
171 {
175 } leVAlignment;
176 
177 // *****************************************************************************
178 /* Enumeration:
179  leHAlignment
180 
181  Summary:
182  legato horizontal alignment values
183 
184  Description:
185  legato horizontal alignment values
186 
187  Remarks:
188  None.
189 */
195 typedef enum
196 {
200 } leHAlignment;
201 
202 // *****************************************************************************
203 /* Enumeration:
204  leMargin
205 
206  Summary:
207  legato margin values
208 
209  Description:
210  legato margin values
211 
212  Remarks:
213  None.
214 */
220 typedef struct leMargin
221 {
222  uint8_t left;
223  uint8_t top;
224  uint8_t right;
225  uint8_t bottom;
226 } leMargin;
227 
232 static const leMargin leMargin_Zero = {0, 0, 0, 0};
233 
234 // *****************************************************************************
235 /* Enumeration:
236  leDirection
237 
238  Summary:
239  legato direction values
240 
241  Description:
242  legato direction values
243 
244  Remarks:
245  None.
246 */
252 typedef enum leDirection
253 {
258 } leDirection;
259 
260 // *****************************************************************************
261 /* Structure:
262  leRotationDirection
263 
264  Summary:
265  Describes rotational direction
266 
267  Description:
268  Describes rotational direction
269 
270  Remarks:
271  None.
272 */
279 {
283 
284 // *****************************************************************************
285 /* Enumeration:
286  leRelativePosition
287 
288  Summary:
289  legato relative position values
290 
291  Description:
292  legato relative position values
293 
294  Remarks:
295  None.
296 */
302 typedef enum leRelativePosition
303 {
310 
311 // *****************************************************************************
312 /* Enumeration:
313  leOrientation
314 
315  Summary:
316  legato orientation values
317 
318  Description:
319  legato orientation values
320 
321  Remarks:
322  None.
323 */
329 typedef enum leOrientation
330 {
331  LE_ORIENTATION_HORIZONTAL,
332  LE_ORIENTATION_VERTICAL,
333 } leOrientation;
334 
335 // *****************************************************************************
336 /* Structure:
337  lePoint
338 
339  Summary:
340  A two dimensional Cartesian point.
341 */
346 typedef struct lePoint
347 {
348  int32_t x;
349  int32_t y;
350 } lePoint;
351 
356 static const lePoint lePoint_Zero = {0, 0};
357 
358 // *****************************************************************************
359 /* Structure:
360  leSize
361 
362  Summary:
363  A two dimensional indication of size. Values are signed but should never be
364  negative.
365 */
370 typedef struct leSize
371 {
372  int32_t width;
373  int32_t height;
374 } leSize;
375 
380 static const leSize leSize_Zero = {0, 0};
381 
382 // *****************************************************************************
383 /* Structure:
384  leRect
385 
386  Summary:
387  A rectangle definition.
388 */
394 typedef struct leRect
395 {
396  int16_t x;
397  int16_t y;
398  int16_t width;
399  int16_t height;
400 } leRect;
401 
407 typedef void* leBuffer;
408 
409 /* library configuration flags */
414 typedef uint16_t leChar;
415 
416 #define LE_UNKNOWN_GLYPH 0xFFFF
417 
418 #define LE_PCALL(var, func, args...) var->fn->func(var, ## args)
419 #define LE_OCALL(var, func, args...) var.fn->func(&var, ## args)
420 
421 #ifdef __cplusplus
422  }
423 #endif
424 
425 #define ASSIGN_VIRTUAL_FUNCTION(name) .name = name
426 #define ASSIGN_VTABLE_FUNCTION(vtable, name) vtable.name = name
427 #endif // LEGATO_COMMON_H
428 
429 /*******************************************************************************
430  End of File
431 */
Definition: legato_common.h:197
Definition: legato_common.h:149
struct leSize leSize
This structure is used represents the size of an item.
Definition: legato_common.h:304
Definition: legato_common.h:305
struct leMargin leMargin
This struct represents the four margin settings for objects.
Definition: legato_common.h:173
leRotationDirection
This enum represents the two rotation direction modes for objects.
Definition: legato_common.h:278
struct leRect leRect
This struct represents a rectangle.
struct lePoint lePoint
This structure represents a integer Cartesian point.
int32_t height
Definition: legato_common.h:373
uint8_t bottom
Definition: legato_common.h:225
Definition: legato_common.h:307
leResult
This enum represents function call results.
Definition: legato_common.h:123
Definition: legato_common.h:199
This struct represents a rectangle.
Definition: legato_common.h:394
leDirection
This enum represents the four directions modes for objects.
Definition: legato_common.h:252
uint8_t left
Definition: legato_common.h:222
Definition: legato_common.h:306
This struct represents the four margin settings for objects.
Definition: legato_common.h:220
Definition: legato_common.h:257
leHAlignment
This enum represents the horizontal alignment mode of objects.
Definition: legato_common.h:195
leRelativePosition
This enum represents the relative position modes for objects.
Definition: legato_common.h:302
int32_t width
Definition: legato_common.h:372
This structure is used represents the size of an item.
Definition: legato_common.h:370
Definition: legato_common.h:254
uint8_t top
Definition: legato_common.h:223
Definition: legato_common.h:255
leOrientation
This enum represents the orientation modes for objects.
Definition: legato_common.h:329
This structure represents a integer Cartesian point.
Definition: legato_common.h:346
Definition: legato_common.h:148
Definition: legato_common.h:172
Definition: legato_common.h:174
Definition: legato_common.h:281
leBool
This enum represents booleans.
Definition: legato_common.h:146
void * leBuffer
This typedef represents general-purpose buffer.
Definition: legato_common.h:407
uint16_t leChar
This typedef represents Legato character.
Definition: legato_common.h:414
Definition: legato_common.h:308
Definition: legato_common.h:198
uint8_t right
Definition: legato_common.h:224
Definition: legato_common.h:280
leVAlignment
This enum represents the vertical alignment mode of objects.
Definition: legato_common.h:170
Definition: legato_common.h:256