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 "../lv_conf_internal.h" 17 18 #ifndef __ASSEMBLY__ 19 #include LV_STDINT_INCLUDE 20 #include LV_STDDEF_INCLUDE 21 #include LV_STDBOOL_INCLUDE 22 #include LV_INTTYPES_INCLUDE 23 #include LV_LIMITS_INCLUDE 24 #include LV_STDARG_INCLUDE 25 #endif 26 27 /********************* 28 * DEFINES 29 *********************/ 30 31 /*If __UINTPTR_MAX__ or UINTPTR_MAX are available, use them to determine arch size*/ 32 #if defined(__UINTPTR_MAX__) && __UINTPTR_MAX__ > 0xFFFFFFFF 33 #define LV_ARCH_64 34 35 #elif defined(UINTPTR_MAX) && UINTPTR_MAX > 0xFFFFFFFF 36 #define LV_ARCH_64 37 38 /*Otherwise use compiler-dependent means to determine arch size*/ 39 #elif defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined (__aarch64__) 40 #define LV_ARCH_64 41 42 #endif 43 44 /********************** 45 * TYPEDEFS 46 **********************/ 47 48 /* Exclude C enum and struct definitions when included by assembly code */ 49 #ifndef __ASSEMBLY__ 50 51 /** 52 * LVGL error codes. 53 */ 54 typedef enum { 55 LV_RESULT_INVALID = 0, /*Typically indicates that the object is deleted (become invalid) in the action 56 function or an operation was failed*/ 57 LV_RESULT_OK, /*The object is valid (no deleted) after the action*/ 58 } lv_result_t; 59 60 #if defined(__cplusplus) || __STDC_VERSION__ >= 199901L 61 /*If c99 or newer, use the definition of uintptr_t directly from <stdint.h>*/ 62 typedef uintptr_t lv_uintptr_t; 63 typedef intptr_t lv_intptr_t; 64 65 #else 66 67 /*Otherwise, use the arch size determination*/ 68 #ifdef LV_ARCH_64 69 typedef uint64_t lv_uintptr_t; 70 typedef int64_t lv_intptr_t; 71 #else 72 typedef uint32_t lv_uintptr_t; 73 typedef int32_t lv_intptr_t; 74 #endif 75 76 #endif 77 78 #if LV_USE_FLOAT 79 typedef float lv_value_precise_t; 80 #else 81 typedef int32_t lv_value_precise_t; 82 #endif 83 84 /** 85 * Typedefs from various lvgl modules. 86 * They are defined here to avoid circular dependencies. 87 */ 88 89 typedef struct _lv_obj_t lv_obj_t; 90 91 typedef uint16_t lv_state_t; 92 typedef uint32_t lv_part_t; 93 94 typedef uint8_t lv_opa_t; 95 96 typedef uint8_t lv_style_prop_t; 97 98 typedef struct _lv_obj_class_t lv_obj_class_t; 99 100 typedef struct _lv_group_t lv_group_t; 101 102 typedef struct _lv_display_t lv_display_t; 103 104 typedef struct _lv_layer_t lv_layer_t; 105 typedef struct _lv_draw_unit_t lv_draw_unit_t; 106 typedef struct _lv_draw_task_t lv_draw_task_t; 107 108 typedef struct _lv_indev_t lv_indev_t; 109 110 typedef struct _lv_event_t lv_event_t; 111 112 typedef struct _lv_timer_t lv_timer_t; 113 114 typedef struct _lv_theme_t lv_theme_t; 115 116 typedef struct _lv_anim_t lv_anim_t; 117 118 typedef struct _lv_font_t lv_font_t; 119 120 typedef struct _lv_image_decoder_t lv_image_decoder_t; 121 122 typedef struct _lv_image_decoder_dsc_t lv_image_decoder_dsc_t; 123 124 typedef struct _lv_fragment_t lv_fragment_t; 125 typedef struct _lv_fragment_class_t lv_fragment_class_t; 126 typedef struct _lv_fragment_managed_states_t lv_fragment_managed_states_t; 127 128 typedef struct _lv_profiler_builtin_config_t lv_profiler_builtin_config_t; 129 130 typedef struct _lv_rb_node_t lv_rb_node_t; 131 132 typedef struct _lv_rb_t lv_rb_t; 133 134 typedef struct _lv_color_filter_dsc_t lv_color_filter_dsc_t; 135 136 typedef struct _lv_event_dsc_t lv_event_dsc_t; 137 138 typedef struct _lv_cache_t lv_cache_t; 139 140 typedef struct _lv_cache_entry_t lv_cache_entry_t; 141 142 typedef struct _lv_fs_file_cache_t lv_fs_file_cache_t; 143 144 typedef struct _lv_fs_path_ex_t lv_fs_path_ex_t; 145 146 typedef struct _lv_image_decoder_args_t lv_image_decoder_args_t; 147 148 typedef struct _lv_image_cache_data_t lv_image_cache_data_t; 149 150 typedef struct _lv_image_header_cache_data_t lv_image_header_cache_data_t; 151 152 typedef struct _lv_draw_mask_t lv_draw_mask_t; 153 154 typedef struct _lv_grad_t lv_grad_t; 155 156 typedef struct _lv_draw_label_hint_t lv_draw_label_hint_t; 157 158 typedef struct _lv_draw_glyph_dsc_t lv_draw_glyph_dsc_t; 159 160 typedef struct _lv_draw_image_sup_t lv_draw_image_sup_t; 161 162 typedef struct _lv_draw_mask_rect_dsc_t lv_draw_mask_rect_dsc_t; 163 164 typedef struct _lv_obj_style_t lv_obj_style_t; 165 166 typedef struct _lv_obj_style_transition_dsc_t lv_obj_style_transition_dsc_t; 167 168 typedef struct _lv_hit_test_info_t lv_hit_test_info_t; 169 170 typedef struct _lv_cover_check_info_t lv_cover_check_info_t; 171 172 typedef struct _lv_obj_spec_attr_t lv_obj_spec_attr_t; 173 174 typedef struct _lv_image_t lv_image_t; 175 176 typedef struct _lv_animimg_t lv_animimg_t; 177 178 typedef struct _lv_arc_t lv_arc_t; 179 180 typedef struct _lv_label_t lv_label_t; 181 182 typedef struct _lv_bar_anim_t lv_bar_anim_t; 183 184 typedef struct _lv_bar_t lv_bar_t; 185 186 typedef struct _lv_button_t lv_button_t; 187 188 typedef struct _lv_buttonmatrix_t lv_buttonmatrix_t; 189 190 typedef struct _lv_calendar_t lv_calendar_t; 191 192 typedef struct _lv_canvas_t lv_canvas_t; 193 194 typedef struct _lv_chart_series_t lv_chart_series_t; 195 196 typedef struct _lv_chart_cursor_t lv_chart_cursor_t; 197 198 typedef struct _lv_chart_t lv_chart_t; 199 200 typedef struct _lv_checkbox_t lv_checkbox_t; 201 202 typedef struct _lv_dropdown_t lv_dropdown_t; 203 204 typedef struct _lv_dropdown_list_t lv_dropdown_list_t; 205 206 typedef struct _lv_imagebutton_src_info_t lv_imagebutton_src_info_t; 207 208 typedef struct _lv_imagebutton_t lv_imagebutton_t; 209 210 typedef struct _lv_keyboard_t lv_keyboard_t; 211 212 typedef struct _lv_led_t lv_led_t; 213 214 typedef struct _lv_line_t lv_line_t; 215 216 typedef struct _lv_menu_load_page_event_data_t lv_menu_load_page_event_data_t; 217 218 typedef struct _lv_menu_history_t lv_menu_history_t; 219 220 typedef struct _lv_menu_t lv_menu_t; 221 222 typedef struct _lv_menu_page_t lv_menu_page_t; 223 224 typedef struct _lv_msgbox_t lv_msgbox_t; 225 226 typedef struct _lv_roller_t lv_roller_t; 227 228 typedef struct _lv_scale_section_t lv_scale_section_t; 229 230 typedef struct _lv_scale_t lv_scale_t; 231 232 typedef struct _lv_slider_t lv_slider_t; 233 234 typedef struct _lv_span_t lv_span_t; 235 236 typedef struct _lv_spangroup_t lv_spangroup_t; 237 238 typedef struct _lv_textarea_t lv_textarea_t; 239 240 typedef struct _lv_spinbox_t lv_spinbox_t; 241 242 typedef struct _lv_switch_t lv_switch_t; 243 244 typedef struct _lv_table_cell_t lv_table_cell_t; 245 246 typedef struct _lv_table_t lv_table_t; 247 248 typedef struct _lv_tabview_t lv_tabview_t; 249 250 typedef struct _lv_tileview_t lv_tileview_t; 251 252 typedef struct _lv_tileview_tile_t lv_tileview_tile_t; 253 254 typedef struct _lv_win_t lv_win_t; 255 256 typedef struct _lv_observer_t lv_observer_t; 257 258 typedef struct _lv_monkey_config_t lv_monkey_config_t; 259 260 typedef struct _lv_ime_pinyin_t lv_ime_pinyin_t; 261 262 typedef struct _lv_file_explorer_t lv_file_explorer_t; 263 264 typedef struct _lv_barcode_t lv_barcode_t; 265 266 typedef struct _lv_gif_t lv_gif_t; 267 268 typedef struct _lv_qrcode_t lv_qrcode_t; 269 270 typedef struct _lv_freetype_outline_vector_t lv_freetype_outline_vector_t; 271 272 typedef struct _lv_freetype_outline_event_param_t lv_freetype_outline_event_param_t; 273 274 typedef struct _lv_fpoint_t lv_fpoint_t; 275 276 typedef struct _lv_matrix_t lv_matrix_t; 277 278 typedef struct _lv_vector_path_t lv_vector_path_t; 279 280 typedef struct _lv_vector_gradient_t lv_vector_gradient_t; 281 282 typedef struct _lv_vector_fill_dsc_t lv_vector_fill_dsc_t; 283 284 typedef struct _lv_vector_stroke_dsc_t lv_vector_stroke_dsc_t; 285 286 typedef struct _lv_vector_draw_dsc_t lv_vector_draw_dsc_t; 287 288 typedef struct _lv_draw_vector_task_dsc_t lv_draw_vector_task_dsc_t; 289 290 typedef struct _lv_vector_dsc_t lv_vector_dsc_t; 291 292 typedef struct _lv_xkb_t lv_xkb_t; 293 294 typedef struct _lv_libinput_event_t lv_libinput_event_t; 295 296 typedef struct _lv_libinput_t lv_libinput_t; 297 298 typedef struct _lv_draw_sw_unit_t lv_draw_sw_unit_t; 299 300 typedef struct _lv_draw_sw_mask_common_dsc_t lv_draw_sw_mask_common_dsc_t; 301 302 typedef struct _lv_draw_sw_mask_line_param_t lv_draw_sw_mask_line_param_t; 303 304 typedef struct _lv_draw_sw_mask_angle_param_t lv_draw_sw_mask_angle_param_t; 305 306 typedef struct _lv_draw_sw_mask_radius_param_t lv_draw_sw_mask_radius_param_t; 307 308 typedef struct _lv_draw_sw_mask_fade_param_t lv_draw_sw_mask_fade_param_t; 309 310 typedef struct _lv_draw_sw_mask_map_param_t lv_draw_sw_mask_map_param_t; 311 312 typedef struct _lv_draw_sw_blend_dsc_t lv_draw_sw_blend_dsc_t; 313 314 typedef struct _lv_draw_sw_blend_fill_dsc_t lv_draw_sw_blend_fill_dsc_t; 315 316 typedef struct _lv_draw_sw_blend_image_dsc_t lv_draw_sw_blend_image_dsc_t; 317 318 typedef struct _lv_draw_buf_handlers_t lv_draw_buf_handlers_t; 319 320 typedef struct _lv_rlottie_t lv_rlottie_t; 321 322 typedef struct _lv_ffmpeg_player_t lv_ffmpeg_player_t; 323 324 typedef struct _lv_glfw_window_t lv_glfw_window_t; 325 typedef struct _lv_glfw_texture_t lv_glfw_texture_t; 326 327 typedef uint32_t lv_prop_id_t; 328 329 typedef struct _lv_array_t lv_array_t; 330 331 typedef struct _lv_iter_t lv_iter_t; 332 333 typedef struct _lv_circle_buf_t lv_circle_buf_t; 334 335 typedef struct _lv_draw_buf_t lv_draw_buf_t; 336 337 #if LV_USE_OBJ_PROPERTY 338 typedef struct _lv_property_name_t lv_property_name_t; 339 #endif 340 341 #if LV_USE_SYSMON 342 343 typedef struct _lv_sysmon_backend_data_t lv_sysmon_backend_data_t; 344 345 #if LV_USE_PERF_MONITOR 346 typedef struct _lv_sysmon_perf_info_t lv_sysmon_perf_info_t; 347 #endif /*LV_USE_PERF_MONITOR*/ 348 349 #endif /*LV_USE_SYSMON*/ 350 351 352 typedef struct _lv_xml_component_ctx_t lv_xml_component_ctx_t; 353 354 typedef struct _lv_xml_parser_state_t lv_xml_parser_state_t; 355 356 #if LV_USE_EVDEV 357 typedef struct _lv_evdev_discovery_t lv_evdev_discovery_t; 358 #endif 359 360 #endif /*__ASSEMBLY__*/ 361 362 /********************** 363 * GLOBAL PROTOTYPES 364 **********************/ 365 366 /********************** 367 * MACROS 368 **********************/ 369 370 #define LV_UNUSED(x) ((void)x) 371 372 #define _LV_CONCAT(x, y) x ## y 373 #define LV_CONCAT(x, y) _LV_CONCAT(x, y) 374 #undef _LV_CONCAT 375 376 #define _LV_CONCAT3(x, y, z) x ## y ## z 377 #define LV_CONCAT3(x, y, z) _LV_CONCAT3(x, y, z) 378 #undef _LV_CONCAT3 379 380 #if defined(PYCPARSER) || defined(__CC_ARM) 381 #define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) 382 #elif defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 4) || __GNUC__ > 4) 383 #define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) __attribute__((format(gnu_printf, fmtstr, vararg))) 384 #elif (defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(__IAR_SYSTEMS_ICC__)) 385 #define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) __attribute__((format(printf, fmtstr, vararg))) 386 #else 387 #define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) 388 #endif 389 390 #ifdef __cplusplus 391 } /*extern "C"*/ 392 #endif 393 394 #endif /*LV_TYPES_H*/ 395