1 /** 2 * @file lv_types.h 3 * 4 */ 5 6 #ifndef LV_TYPES_H 7 #define LV_TYPES_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include <stdint.h> 17 18 /********************* 19 * DEFINES 20 *********************/ 21 22 // If __UINTPTR_MAX__ or UINTPTR_MAX are available, use them to determine arch size 23 #if defined(__UINTPTR_MAX__) && __UINTPTR_MAX__ > 0xFFFFFFFF 24 #define LV_ARCH_64 25 26 #elif defined(UINTPTR_MAX) && UINTPTR_MAX > 0xFFFFFFFF 27 #define LV_ARCH_64 28 29 // Otherwise use compiler-dependent means to determine arch size 30 #elif defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined (__aarch64__) 31 #define LV_ARCH_64 32 33 #endif 34 35 /********************** 36 * TYPEDEFS 37 **********************/ 38 39 /** 40 * LVGL error codes. 41 */ 42 enum { 43 LV_RES_INV = 0, /*Typically indicates that the object is deleted (become invalid) in the action 44 function or an operation was failed*/ 45 LV_RES_OK, /*The object is valid (no deleted) after the action*/ 46 }; 47 typedef uint8_t lv_res_t; 48 49 #if defined(__cplusplus) || __STDC_VERSION__ >= 199901L 50 // If c99 or newer, use the definition of uintptr_t directly from <stdint.h> 51 typedef uintptr_t lv_uintptr_t; 52 53 #else 54 55 // Otherwise, use the arch size determination 56 #ifdef LV_ARCH_64 57 typedef uint64_t lv_uintptr_t; 58 #else 59 typedef uint32_t lv_uintptr_t; 60 #endif 61 62 #endif 63 64 /********************** 65 * GLOBAL PROTOTYPES 66 **********************/ 67 68 /********************** 69 * MACROS 70 **********************/ 71 72 #define LV_UNUSED(x) ((void)x) 73 74 #define _LV_CONCAT(x, y) x ## y 75 #define LV_CONCAT(x, y) _LV_CONCAT(x, y) 76 77 #define _LV_CONCAT3(x, y, z) x ## y ## z 78 #define LV_CONCAT3(x, y, z) _LV_CONCAT3(x, y, z) 79 80 #if defined(PYCPARSER) || defined(__CC_ARM) 81 #define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) 82 #elif defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 4) || __GNUC__ > 4) 83 #define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) __attribute__((format(gnu_printf, fmtstr, vararg))) 84 #elif (defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)) 85 #define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) __attribute__((format(printf, fmtstr, vararg))) 86 #else 87 #define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) 88 #endif 89 90 #ifdef __cplusplus 91 } /*extern "C"*/ 92 #endif 93 94 #endif /*LV_TYPES_H*/ 95