├── .gitattributes ├── CMakeLists.txt ├── LICENSE ├── README.md ├── driver ├── CMakeLists.txt ├── gt_driver.mk ├── gt_font_config.c ├── gt_font_config.h ├── gt_gui_driver.c ├── gt_gui_driver.h ├── gt_port_disp.c ├── gt_port_disp.h ├── gt_port_indev.c ├── gt_port_indev.h ├── gt_port_src.c ├── gt_port_src.h ├── gt_port_vf.c └── gt_port_vf.h ├── examples ├── ReadMe.md ├── gt_examples.h └── widgets │ ├── gt_example_anim1.c │ ├── gt_example_button.c │ ├── gt_example_checkbox.c │ ├── gt_example_img.c │ ├── gt_example_img_button.c │ ├── gt_example_input.c │ ├── gt_example_keyboard.c │ ├── gt_example_label.c │ ├── gt_example_line.c │ ├── gt_example_listview.c │ ├── gt_example_progress_bar.c │ └── gt_example_roller.c ├── gt.h ├── gui.mk ├── images ├── 图片按钮.gif ├── 多国语言.gif ├── 幻灯片.gif ├── 矢量字库.gif ├── 矢量字库示例.png ├── 组合.gif ├── 键盘.gif └── 高通GitHub运营版面logo.png ├── sources ├── Doxyfile ├── ReadMe.md ├── gif │ └── button.gif └── gt-gui.png ├── src ├── CMakeLists.txt ├── core │ ├── gt_core.mk │ ├── gt_disp.c │ ├── gt_disp.h │ ├── gt_draw.c │ ├── gt_draw.h │ ├── gt_event.c │ ├── gt_event.h │ ├── gt_fs.c │ ├── gt_fs.h │ ├── gt_graph_base.c │ ├── gt_graph_base.h │ ├── gt_handler.c │ ├── gt_handler.h │ ├── gt_img_decoder.c │ ├── gt_img_decoder.h │ ├── gt_indev.c │ ├── gt_indev.h │ ├── gt_layout.c │ ├── gt_layout.h │ ├── gt_mask.c │ ├── gt_mask.h │ ├── gt_mem.c │ ├── gt_mem.h │ ├── gt_obj_pos.c │ ├── gt_obj_pos.h │ ├── gt_obj_scroll.c │ ├── gt_obj_scroll.h │ ├── gt_refr.c │ ├── gt_refr.h │ ├── gt_scr_stack.c │ ├── gt_scr_stack.h │ ├── gt_style.c │ ├── gt_style.h │ ├── gt_timer.c │ └── gt_timer.h ├── extra │ ├── draw │ │ ├── gt_draw.mk │ │ ├── gt_draw_blend.c │ │ ├── gt_draw_blend.h │ │ ├── gt_draw_blend_with_argb888.c │ │ ├── gt_draw_blend_with_argb888.h │ │ ├── gt_draw_blend_with_rgb565.c │ │ ├── gt_draw_blend_with_rgb565.h │ │ ├── gt_draw_blend_with_rgb888.c │ │ └── gt_draw_blend_with_rgb888.h │ ├── gif │ │ ├── gifdec.c │ │ ├── gifdec.h │ │ └── gt_gif.mk │ ├── gt_extra.c │ ├── gt_extra.h │ ├── gt_extra.mk │ ├── jpeg │ │ ├── gt_jpeg.mk │ │ ├── gt_sjpg.c │ │ ├── gt_sjpg.h │ │ ├── tjpgd.c │ │ ├── tjpgd.h │ │ └── tjpgdcnf.h │ ├── md4c │ │ ├── entity.c │ │ ├── entity.h │ │ ├── gt_md4c.mk │ │ ├── md4c-html.c │ │ ├── md4c-html.h │ │ ├── md4c.c │ │ └── md4c.h │ ├── png │ │ ├── gt_png.c │ │ ├── gt_png.h │ │ ├── gt_png.mk │ │ ├── lodepng.c │ │ └── lodepng.h │ └── serial │ │ ├── gt_serial.mk │ │ ├── gt_serial_area_light.c │ │ ├── gt_serial_area_light.h │ │ ├── gt_serial_cfg.c │ │ ├── gt_serial_cfg.h │ │ ├── gt_serial_command.c │ │ ├── gt_serial_command.h │ │ ├── gt_serial_event.c │ │ ├── gt_serial_event.h │ │ ├── gt_serial_qrcode.c │ │ ├── gt_serial_qrcode.h │ │ ├── gt_serial_resource.c │ │ ├── gt_serial_resource.h │ │ ├── gt_serial_show.c │ │ ├── gt_serial_show.h │ │ ├── gt_serial_system.c │ │ ├── gt_serial_system.h │ │ ├── gt_serial_value_passing.c │ │ ├── gt_serial_value_passing.h │ │ ├── gt_serial_var.c │ │ ├── gt_serial_var.h │ │ ├── gt_serial_var_anim_icon.c │ │ ├── gt_serial_var_anim_icon.h │ │ ├── gt_serial_var_artistic.c │ │ ├── gt_serial_var_artistic.h │ │ ├── gt_serial_var_bit.c │ │ ├── gt_serial_var_bit.h │ │ ├── gt_serial_var_hex.c │ │ ├── gt_serial_var_hex.h │ │ ├── gt_serial_var_icon.c │ │ ├── gt_serial_var_icon.h │ │ ├── gt_serial_var_input.c │ │ ├── gt_serial_var_input.h │ │ ├── gt_serial_var_keypad.c │ │ ├── gt_serial_var_keypad.h │ │ ├── gt_serial_var_numb.c │ │ ├── gt_serial_var_numb.h │ │ ├── gt_serial_var_pic.c │ │ ├── gt_serial_var_pic.h │ │ ├── gt_serial_var_progress_bar.c │ │ ├── gt_serial_var_progress_bar.h │ │ ├── gt_serial_var_roller.c │ │ ├── gt_serial_var_roller.h │ │ ├── gt_serial_var_rtc.c │ │ ├── gt_serial_var_rtc.h │ │ ├── gt_serial_var_slider.c │ │ ├── gt_serial_var_slider.h │ │ ├── gt_serial_var_text.c │ │ └── gt_serial_var_text.h ├── font │ ├── gt_font.c │ ├── gt_font.h │ ├── gt_font.mk │ ├── gt_symbol.c │ └── gt_symbol.h ├── gt_api_mapper.h ├── gt_conf.h ├── hal │ ├── gt_hal.mk │ ├── gt_hal_disp.c │ ├── gt_hal_disp.h │ ├── gt_hal_file_header.c │ ├── gt_hal_file_header.h │ ├── gt_hal_fs.c │ ├── gt_hal_fs.h │ ├── gt_hal_indev.c │ ├── gt_hal_indev.h │ ├── gt_hal_src.c │ ├── gt_hal_src.h │ ├── gt_hal_tick.c │ ├── gt_hal_tick.h │ ├── gt_hal_vf.c │ └── gt_hal_vf.h ├── others │ ├── gt_anim.c │ ├── gt_anim.h │ ├── gt_area.c │ ├── gt_area.h │ ├── gt_assert.h │ ├── gt_color.c │ ├── gt_color.h │ ├── gt_crc.c │ ├── gt_crc.h │ ├── gt_defs.h │ ├── gt_gc.c │ ├── gt_gc.h │ ├── gt_list.h │ ├── gt_ll.c │ ├── gt_ll.h │ ├── gt_log.h │ ├── gt_math.c │ ├── gt_math.h │ ├── gt_others.mk │ ├── gt_tlsf.c │ ├── gt_tlsf.h │ ├── gt_txt.c │ ├── gt_txt.h │ └── gt_types.h ├── utils │ ├── gt_bin_convert.c │ ├── gt_bin_convert.h │ ├── gt_img_cache.c │ ├── gt_img_cache.h │ ├── gt_queue.c │ ├── gt_queue.h │ ├── gt_serial.c │ ├── gt_serial.h │ ├── gt_stack.c │ ├── gt_stack.h │ ├── gt_utils.mk │ ├── gt_vector.c │ └── gt_vector.h └── widgets │ ├── gt_arc.c │ ├── gt_arc.h │ ├── gt_barcode.c │ ├── gt_barcode.h │ ├── gt_btn.c │ ├── gt_btn.h │ ├── gt_btnmap.c │ ├── gt_btnmap.h │ ├── gt_chat.c │ ├── gt_chat.h │ ├── gt_checkbox.c │ ├── gt_checkbox.h │ ├── gt_clock.c │ ├── gt_clock.h │ ├── gt_conf_widgets.h │ ├── gt_dialog.c │ ├── gt_dialog.h │ ├── gt_gif.c │ ├── gt_gif.h │ ├── gt_graphs.c │ ├── gt_graphs.h │ ├── gt_group.c │ ├── gt_group.h │ ├── gt_img.c │ ├── gt_img.h │ ├── gt_imgbtn.c │ ├── gt_imgbtn.h │ ├── gt_input.c │ ├── gt_input.h │ ├── gt_input_number.c │ ├── gt_input_number.h │ ├── gt_keypad.c │ ├── gt_keypad.h │ ├── gt_label.c │ ├── gt_label.h │ ├── gt_line.c │ ├── gt_line.h │ ├── gt_listview.c │ ├── gt_listview.h │ ├── gt_markdown.c │ ├── gt_markdown.h │ ├── gt_media_player.c │ ├── gt_media_player.h │ ├── gt_obj.c │ ├── gt_obj.h │ ├── gt_obj_class.c │ ├── gt_obj_class.h │ ├── gt_option.c │ ├── gt_option.h │ ├── gt_player.c │ ├── gt_player.h │ ├── gt_progress_bar.c │ ├── gt_progress_bar.h │ ├── gt_qrcode.c │ ├── gt_qrcode.h │ ├── gt_radio.c │ ├── gt_radio.h │ ├── gt_rect.c │ ├── gt_rect.h │ ├── gt_roller.c │ ├── gt_roller.h │ ├── gt_select.c │ ├── gt_select.h │ ├── gt_slider.c │ ├── gt_slider.h │ ├── gt_status_bar.c │ ├── gt_status_bar.h │ ├── gt_switch.c │ ├── gt_switch.h │ ├── gt_table.c │ ├── gt_table.h │ ├── gt_template.c │ ├── gt_template.h │ ├── gt_textarea.c │ ├── gt_textarea.h │ ├── gt_view_pager.c │ ├── gt_view_pager.h │ ├── gt_widgets.mk │ ├── gt_wordart.c │ ├── gt_wordart.h │ └── serial │ ├── gt_bit_img.c │ ├── gt_bit_img.h │ └── gt_widgets_serial.mk └── test ├── gt_test.mk ├── gt_test_rand_widget.c └── gt_test_rand_widget.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 3.0.0) 3 | project(gt_gui) 4 | 5 | file(GLOB_RECURSE SRC_LIST "driver" "gt_gui_driver.c") 6 | add_library(gt_gui_driver ${SRC_LIST}) 7 | 8 | file(GLOB_RECURSE SRC_LIST "src" "*.c") #递归搜索 9 | add_library(gt_gui ${SRC_LIST}) 10 | 11 | # cmake_minimum_required(VERSION 3.10) 12 | 13 | # project(gt_gui VERSION 1.0) 14 | 15 | # # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined,dynamic_lookup") 16 | # # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined") 17 | 18 | # message(STATUS "project name: ${PROJECT_NAME}") 19 | 20 | # set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) 21 | 22 | # set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) 23 | 24 | # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 25 | 26 | # # add sub directories 27 | # add_subdirectory(src) 28 | # add_subdirectory(driver) 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, ShenZhen GaoTongFont Co., LTD All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /driver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(driver) 2 | 3 | include_directories( 4 | ${PROJECT_SOURCE_DIR}/*.h 5 | ) 6 | 7 | set(SOURCES 8 | ${PROJECT_SOURCE_DIR}/*.c 9 | ) 10 | 11 | -------------------------------------------------------------------------------- /driver/gt_driver.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/driver/*.c)) 2 | 3 | 4 | DEPPATH += --dep-path $(HMI_DIR)/driver 5 | VPATH += :$(HMI_DIR)/driver 6 | 7 | CFLAGS += "-I$(HMI_DIR)/driver" 8 | -------------------------------------------------------------------------------- /driver/gt_font_config.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_font_config.c 3 | * @author Yang (your@email.com) 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-07-19 10:09:10 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "gt_font_config.h" 12 | #include "../gt.h" 13 | #include "../src/gt_conf.h" 14 | 15 | /* private define -------------------------------------------------------*/ 16 | 17 | 18 | 19 | /* private typedef ------------------------------------------------------*/ 20 | 21 | 22 | 23 | /* static prototypes ----------------------------------------------------*/ 24 | 25 | 26 | 27 | /* static variables -----------------------------------------------------*/ 28 | static const gt_font_family_st* _font_family = NULL; 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* static functions -----------------------------------------------------*/ 36 | 37 | 38 | 39 | /* global functions / API interface -------------------------------------*/ 40 | void gt_font_config_init(void) 41 | { 42 | gt_font_family_init(_font_family, 0); 43 | } 44 | 45 | 46 | /* end of file ----------------------------------------------------------*/ 47 | 48 | 49 | -------------------------------------------------------------------------------- /driver/gt_font_config.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_font_config.h 3 | * @author Yang (your@email.com) 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-07-19 10:09:29 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_FONT_CONFIG_H_ 10 | #define _GT_FONT_CONFIG_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "stdint.h" 18 | #include "stdbool.h" 19 | #include "stddef.h" 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | /* typedef --------------------------------------------------------------*/ 26 | typedef enum { 27 | family_none = -1, 28 | }gt_font_family_et; 29 | 30 | 31 | 32 | /* macros ---------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* global functions / API interface -------------------------------------*/ 37 | void gt_font_config_init(void); 38 | 39 | 40 | 41 | #ifdef __cplusplus 42 | } /*extern "C"*/ 43 | #endif 44 | 45 | #endif //!_GT_FONT_CONFIG_H_ 46 | 47 | /* end of file ----------------------------------------------------------*/ 48 | 49 | 50 | -------------------------------------------------------------------------------- /driver/gt_gui_driver.c: -------------------------------------------------------------------------------- 1 | #include "gt_gui_driver.h" 2 | #include 3 | 4 | typedef enum _gt_font_charset_s { 5 | GT_CHARSET_UTF8 = 0, 6 | GT_CHARSET_GB , 7 | }gt_font_charset_st; 8 | static gt_font_charset_st gt_font_chinese_encoding = GT_CHARSET_UTF8; 9 | void GT_Set_Chinese_Charset_Type(unsigned char charset) 10 | { 11 | gt_font_chinese_encoding = charset; 12 | } 13 | unsigned char GT_Get_Chinese_Charset_Type(void) 14 | { 15 | return gt_font_chinese_encoding; 16 | } 17 | 18 | unsigned int GBKToUnicode(unsigned int fontcode) 19 | { 20 | return 0; 21 | } 22 | unsigned int UnicodeToGBK(unsigned int fontcode) 23 | { 24 | return 0; 25 | } 26 | unsigned int BIG5ToGBK(unsigned int fontcode) 27 | { 28 | return 0; 29 | } 30 | unsigned int Shift_JIS_To_JIS0208(unsigned int fontcode) 31 | { 32 | return 0; 33 | } 34 | 35 | 36 | const struct gt_font_func_s gt_get_font_func[] = { 37 | {.option = 0 , .func.read_dot_font = NULL , .type = 1}, 38 | }; 39 | /*------------------------------------------------------------------ Separation -----------------------------------------------------------------*/ 40 | /* global functions / API interface -------------------------------------*/ 41 | 42 | /** 43 | * @brief 得到文字的宽度 44 | * 45 | * @param fontcode 文字编码 46 | * @param font_option 字体选择 47 | * @param size 文字大小(矢量使用) 48 | * @param gray 文字灰度(矢量使用) 49 | * @param pBits 存储数据(矢量使用) 50 | * @return int 宽度 51 | */ 52 | int GT_Get_Font_Width(unsigned long fontcode, unsigned int font_option, unsigned int size , unsigned int gray , unsigned char* pBits) 53 | { 54 | return 0; 55 | } 56 | /** 57 | * @brief 得到文字的高度 58 | * 59 | * @param fontcode 文字编码 60 | * @param font_option 字体选择 61 | * @param size 文字大小(矢量使用 62 | * @param gray 文字灰度(矢量使用) 63 | * @return int 宽度 64 | */ 65 | int GT_Get_Font_Height(unsigned long fontcode, unsigned int font_option, unsigned int size , unsigned int gray) 66 | { 67 | return 0; 68 | } 69 | /** 70 | * @brief 检查字体是否是矢量字体 71 | * 72 | * @param font_option 字体选择 73 | * @return true 是矢量 74 | * @return false 不是矢量 75 | */ 76 | char GT_Check_Is_Vec(unsigned int font_option) 77 | { 78 | return 0; 79 | } 80 | /** 81 | * @brief 得到文字字体读取函数 82 | * 83 | * @param style 字体类型 84 | * @return struct gt_font_func_s* @gt_font_func_s 85 | */ 86 | struct gt_font_func_s* GT_Get_Font_Func_S(unsigned int style) 87 | { 88 | return NULL; 89 | } 90 | unsigned char GT_Get_Font_Type(unsigned int style) 91 | { 92 | return 0; 93 | } 94 | 95 | int GT_Font_Code_Transform(font_convertor_st* convert) 96 | { 97 | unsigned int len = 0; 98 | 99 | if (NULL == convert) 100 | { 101 | return len; 102 | } 103 | 104 | len = convert->code_len; 105 | switch (convert->font_option) 106 | { 107 | 108 | default: 109 | break; 110 | } 111 | 112 | return len; 113 | } 114 | int GT_Get_Font_Convertor_Data(font_convertor_st* convert, uint32_t pos) 115 | { 116 | unsigned int len = 0; 117 | 118 | if (NULL == convert) 119 | { 120 | return len; 121 | } 122 | 123 | len = convert->code_len; 124 | switch (convert->font_option) 125 | { 126 | 127 | default: 128 | break; 129 | } 130 | 131 | return len; 132 | } 133 | /*------------------------------------------------------------------ end of file -----------------------------------------------------------------*/ 134 | -------------------------------------------------------------------------------- /driver/gt_port_disp.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_port_disp.c 3 | * @author yongg 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-06-22 14:41:30 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "gt_port_disp.h" 12 | #include "../gt.h" 13 | #include "../src/gt_conf.h" 14 | 15 | /* private define -------------------------------------------------------*/ 16 | 17 | 18 | 19 | /* private typedef ------------------------------------------------------*/ 20 | 21 | 22 | 23 | /* static variables -----------------------------------------------------*/ 24 | static gt_disp_drv_st drv; 25 | 26 | #if(GT_REFRESH_STYLE == GT_REFRESH_STYLE_0) 27 | 28 | #elif(GT_REFRESH_STYLE == GT_REFRESH_STYLE_1) 29 | static gt_color_t buf1[GT_SCREEN_WIDTH * GT_REFRESH_FLUSH_LINE_PRE_TIME]; 30 | #elif(GT_REFRESH_STYLE == GT_REFRESH_STYLE_2) 31 | static gt_color_t buf1[GT_SCREEN_WIDTH * GT_REFRESH_FLUSH_LINE_PRE_TIME]; 32 | static gt_color_t buf2[GT_SCREEN_WIDTH * GT_REFRESH_FLUSH_LINE_PRE_TIME]; 33 | #elif(GT_REFRESH_STYLE == GT_REFRESH_STYLE_3) 34 | static gt_color_t buf_all[GT_SCREEN_WIDTH * GT_SCREEN_HEIGHT]; 35 | #endif 36 | 37 | /* macros ---------------------------------------------------------------*/ 38 | 39 | 40 | 41 | /* static functions -----------------------------------------------------*/ 42 | 43 | 44 | 45 | /* global functions / API interface -------------------------------------*/ 46 | 47 | 48 | extern void _flush_cb(struct _gt_disp_drv_s * drv, gt_area_st * area, gt_color_t * color); 49 | 50 | void gt_port_disp_init(void) 51 | { 52 | gt_disp_drv_init(&drv); 53 | drv.res_hor = GT_SCREEN_WIDTH; 54 | drv.res_ver = GT_SCREEN_HEIGHT; 55 | drv.flush_cb = _flush_cb; 56 | drv.rotated = GT_ROTATED_0; 57 | 58 | #if(GT_REFRESH_STYLE == GT_REFRESH_STYLE_0) 59 | 60 | #elif(GT_REFRESH_STYLE == GT_REFRESH_STYLE_1) 61 | gt_disp_graph_buf_init(buf1, NULL, NULL); 62 | #elif(GT_REFRESH_STYLE == GT_REFRESH_STYLE_2) 63 | gt_disp_graph_buf_init(buf1, buf2, NULL); 64 | #elif(GT_REFRESH_STYLE == GT_REFRESH_STYLE_3) 65 | gt_disp_graph_buf_init(NULL, NULL, buf_all); 66 | #endif 67 | 68 | gt_disp_drv_register(&drv); 69 | } 70 | 71 | 72 | /* end ------------------------------------------------------------------*/ 73 | -------------------------------------------------------------------------------- /driver/gt_port_disp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_port_disp.h 3 | * @author yongg 4 | * @brief The Interface of the display screen 5 | * @version 0.1 6 | * @date 2022-06-22 14:41:38 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_PORT_DISP_H_ 10 | #define _GT_PORT_DISP_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* typedef --------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* global functions / API interface -------------------------------------*/ 33 | 34 | /** 35 | * @brief display buffer init 36 | */ 37 | void gt_port_disp_init(void); 38 | 39 | 40 | #ifdef __cplusplus 41 | } /*extern "C"*/ 42 | #endif 43 | 44 | #endif //!_GT_PORT_DISP_H_ 45 | -------------------------------------------------------------------------------- /driver/gt_port_indev.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_port_indev.c 3 | * @author yongg 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-06-22 14:33:01 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "gt_port_indev.h" 12 | #include "../src/hal/gt_hal_indev.h" 13 | #include "../gt.h" 14 | 15 | /* private define -------------------------------------------------------*/ 16 | 17 | 18 | 19 | /* private typedef ------------------------------------------------------*/ 20 | 21 | 22 | 23 | /* static variables -----------------------------------------------------*/ 24 | static gt_indev_drv_st indev_drv_pointer; 25 | #if _EXAMPLE 26 | static gt_indev_drv_st indev_drv_keypad; 27 | #endif 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* static functions -----------------------------------------------------*/ 35 | 36 | 37 | 38 | /* global functions / API interface -------------------------------------*/ 39 | 40 | extern void read_cb(struct _gt_indev_drv_s * indev_drv, gt_indev_data_st * data); 41 | extern void read_cb_btn(struct _gt_indev_drv_s * indev_drv, gt_indev_data_st * data); 42 | 43 | void gt_port_indev_init(void) 44 | { 45 | /* register a touch screen dev */ 46 | gt_indev_drv_init(&indev_drv_pointer); 47 | indev_drv_pointer.read_cb = read_cb; 48 | indev_drv_pointer.type = GT_INDEV_TYPE_POINTER; 49 | gt_indev_drv_register(&indev_drv_pointer); 50 | 51 | #if _EXAMPLE 52 | /* register a keypad dev */ 53 | gt_indev_drv_init(&indev_drv_keypad); 54 | indev_drv_keypad.read_cb = read_cb_btn; 55 | indev_drv_keypad.type = GT_INDEV_TYPE_KEYPAD; 56 | gt_indev_drv_register(&indev_drv_keypad); 57 | #endif 58 | } 59 | 60 | 61 | /* end ------------------------------------------------------------------*/ 62 | -------------------------------------------------------------------------------- /driver/gt_port_indev.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_port_indev.h 3 | * @author yongg 4 | * @brief input device implementation 5 | * @version 0.1 6 | * @date 2022-06-22 14:32:51 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_PORT_INDEV_H_ 10 | #define _GT_PORT_INDEV_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* typedef --------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* global functions / API interface -------------------------------------*/ 33 | 34 | /** 35 | * @brief input device initialization 36 | */ 37 | void gt_port_indev_init(void); 38 | 39 | 40 | #ifdef __cplusplus 41 | } /*extern "C"*/ 42 | #endif 43 | 44 | #endif //!_GT_PORT_INDEV_H_ 45 | -------------------------------------------------------------------------------- /driver/gt_port_src.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_port_src.h 3 | * @author Feyoung 4 | * @brief Array resource management implementation 5 | * @version 0.1 6 | * @date 2022-08-31 11:26:54 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_PORT_SRC_H_ 10 | #define _GT_PORT_SRC_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | 18 | #include "../src/hal/gt_hal_src.h" 19 | 20 | 21 | /* define ---------------------------------------------------------------*/ 22 | 23 | 24 | 25 | /* typedef --------------------------------------------------------------*/ 26 | 27 | 28 | 29 | /* macros ---------------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* class ----------------------------------------------------------------*/ 34 | 35 | 36 | 37 | /* global functions / API interface -------------------------------------*/ 38 | 39 | void gt_port_src_init(void); 40 | 41 | 42 | #ifdef __cplusplus 43 | } /*extern "C"*/ 44 | #endif 45 | 46 | #endif //!_GT_PORT_SRC_H_ 47 | -------------------------------------------------------------------------------- /driver/gt_port_vf.c: -------------------------------------------------------------------------------- 1 | 2 | /* include --------------------------------------------------------------*/ 3 | #include "gt_port_vf.h" 4 | #include "../src/others/gt_log.h" 5 | 6 | 7 | /* private define -------------------------------------------------------*/ 8 | 9 | 10 | 11 | /* private typedef ------------------------------------------------------*/ 12 | 13 | 14 | 15 | /* static variables -----------------------------------------------------*/ 16 | static const gt_vfs_st virt_file_sys[] ={ 17 | /* name, w, h, addr, size, is_alpha */ 18 | {"f:img_115x138_606.png", 115, 138, 2351088, 47610, 1}, 19 | {"f:img_115x138_607.png", 115, 138, 2398698, 47610, 1}, 20 | {NULL,0,0,0,0}, 21 | }; 22 | 23 | 24 | /* macros ---------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* static functions -----------------------------------------------------*/ 29 | 30 | 31 | /* global functions / API interface -------------------------------------*/ 32 | 33 | #if GT_USE_MODE_FLASH 34 | /** 35 | * @brief [HMI-chip or flash] write or read data from HMI-chip or flash 36 | * 37 | * @param data_write the data to be written 38 | * @param len_write the length of the data to be written 39 | * @param data_read the data to be read from flash 40 | * @param len_read the length need to read from flash 41 | * 42 | * @return uint32_t The number of bytes data read back preferentially, 43 | * otherwise the number of bytes written successfully. 44 | */ 45 | extern uint32_t spi_wr(uint8_t * data_write, uint32_t len_write, uint8_t * data_read, uint32_t len_read); 46 | 47 | #endif 48 | 49 | void gt_port_vf_init(void) 50 | { 51 | gt_vf_init(virt_file_sys); 52 | 53 | #if GT_USE_MODE_FLASH 54 | gt_vf_drv_register(spi_wr); 55 | #endif 56 | } 57 | 58 | 59 | 60 | /* end ------------------------------------------------------------------*/ 61 | 62 | -------------------------------------------------------------------------------- /driver/gt_port_vf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_port_vf.h 3 | * @author yongg 4 | * @brief Flash Resource management implementation 5 | * @version 0.1 6 | * @date 2022-06-22 09:58:13 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_PORT_VF_H_ 10 | #define _GT_PORT_VF_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../gt.h" 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* typedef --------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* global functions / API interface -------------------------------------*/ 33 | 34 | /** 35 | * @brief Flash resource management initialization 36 | */ 37 | void gt_port_vf_init(void); 38 | 39 | 40 | #ifdef __cplusplus 41 | } /*extern "C"*/ 42 | #endif 43 | 44 | #endif //!_GT_PORT_VF_H_ 45 | -------------------------------------------------------------------------------- /examples/ReadMe.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaotongfont/GT-HMI-Engine/f4df4a90a7737d1ba3e11ed7d7bcad20b06d2ce5/examples/ReadMe.md -------------------------------------------------------------------------------- /examples/gt_examples.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_examples.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-09-28 11:40:52 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_EXAMPLES_H_ 10 | #define _GT_EXAMPLES_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | 18 | #include "../src/gt_conf.h" 19 | #include "../others/gt_log.h" 20 | #include "../src/core/gt_style.h" 21 | #include "../src/core/gt_disp.h" 22 | #include "../src/widgets/gt_obj.h" 23 | 24 | 25 | /* define ---------------------------------------------------------------*/ 26 | 27 | 28 | 29 | /* typedef --------------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* macros ---------------------------------------------------------------*/ 34 | 35 | 36 | 37 | /* class ----------------------------------------------------------------*/ 38 | 39 | 40 | 41 | /* global functions / API interface -------------------------------------*/ 42 | 43 | #if GT_USE_EXAMPLES 44 | 45 | void gt_examples_anim1(void); 46 | 47 | void gt_examples_button(void); 48 | 49 | void gt_examples_checkbox(void); 50 | 51 | void gt_examples_img_button(void); 52 | 53 | void gt_examples_img(void); 54 | 55 | void gt_example_input(void); 56 | 57 | void gt_examples_keyboard(void); 58 | 59 | void gt_examples_label(void); 60 | 61 | void gt_examples_line(void); 62 | 63 | void gt_examples_listview(void); 64 | 65 | void gt_examples_progress_bar(void); 66 | 67 | void gt_examples_roller(void); 68 | 69 | #endif /* !GT_USE_EXAMPLES */ 70 | 71 | #ifdef __cplusplus 72 | } /*extern "C"*/ 73 | #endif 74 | 75 | #endif //!_GT_EXAMPLES_H_ 76 | -------------------------------------------------------------------------------- /examples/widgets/gt_example_anim1.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_example_anim1.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-11-29 19:43:40 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "string.h" 12 | #include "../gt_examples.h" 13 | #include "../../src/core/gt_mem.h" 14 | #include "../../src/core/gt_event.h" 15 | #include "../../src/widgets/gt_btn.h" 16 | #include "../../src/widgets/gt_label.h" 17 | #include "../../src/others/gt_anim.h" 18 | 19 | 20 | /* private define -------------------------------------------------------*/ 21 | #if GT_USE_EXAMPLES 22 | 23 | 24 | 25 | /* private typedef ------------------------------------------------------*/ 26 | 27 | 28 | 29 | /* static variables -----------------------------------------------------*/ 30 | 31 | 32 | 33 | /* macros ---------------------------------------------------------------*/ 34 | 35 | 36 | 37 | /* class ----------------------------------------------------------------*/ 38 | 39 | 40 | 41 | /* static functions -----------------------------------------------------*/ 42 | 43 | static void _btn_exec_cb(gt_obj_st * obj, int32_t value) 44 | { 45 | // gt_obj_set_y(obj, value); 46 | gt_obj_set_pos(obj, obj->area.x, value); 47 | printf("_btn_exec_cb: %d\n", value); 48 | } 49 | 50 | static void btn_click_cb(gt_event_st * e) 51 | { 52 | static int cnt_idx = 0; 53 | char buffer[100]; 54 | 55 | memset(buffer, 0, sizeof(buffer)); 56 | sprintf(buffer, "btn %d", ++cnt_idx); 57 | printf("%s\n", buffer); 58 | gt_btn_set_text(e->target, buffer); 59 | 60 | gt_anim_st anim; 61 | gt_anim_init(&anim); 62 | gt_anim_set_target(&anim, e->target); 63 | gt_anim_set_exec_cb(&anim, _btn_exec_cb); 64 | if (e->target->area.y == 30) { 65 | gt_anim_set_value(&anim, 30, 400); 66 | gt_anim_set_path_type(&anim, GT_ANIM_PATH_TYPE_OVERSHOOT); 67 | } else { 68 | gt_anim_set_value(&anim, 400, 30); 69 | gt_anim_set_path_type(&anim, GT_ANIM_PATH_TYPE_OVERSHOOT); 70 | } 71 | gt_anim_start(&anim); 72 | } 73 | 74 | 75 | /* global functions / API interface -------------------------------------*/ 76 | 77 | /** 78 | * @brief create a button, and click it will printf touch count and display 79 | * animation 80 | */ 81 | void gt_examples_anim1(void) 82 | { 83 | gt_obj_st * screen; 84 | screen = gt_obj_create(NULL); 85 | 86 | gt_obj_st * btn = gt_btn_create(screen); 87 | gt_obj_set_pos(btn, 0, 30); 88 | gt_obj_set_size(btn, 200, 100); 89 | gt_obj_add_event_cb(btn, btn_click_cb, GT_EVENT_TYPE_INPUT_RELEASED, NULL); 90 | 91 | gt_disp_load_scr(screen); 92 | } 93 | 94 | #endif 95 | /* end ------------------------------------------------------------------*/ 96 | -------------------------------------------------------------------------------- /examples/widgets/gt_example_button.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_example_button.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-09-28 11:41:32 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "../gt_examples.h" 12 | #include "string.h" 13 | #include "../../src/core/gt_event.h" 14 | #include "../../src/widgets/gt_btn.h" 15 | #include "../../src/widgets/gt_label.h" 16 | 17 | 18 | /* private define -------------------------------------------------------*/ 19 | #if GT_USE_EXAMPLES 20 | 21 | 22 | 23 | /* private typedef ------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* static variables -----------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* class ----------------------------------------------------------------*/ 36 | 37 | 38 | 39 | /* static functions -----------------------------------------------------*/ 40 | 41 | static void btn_click_cb(gt_event_st * e) 42 | { 43 | static int cnt_idx = 0; 44 | char buffer[100]; 45 | 46 | memset(buffer, 0, sizeof(buffer)); 47 | sprintf(buffer, "btn %d", ++cnt_idx); 48 | printf("%s\n", buffer); 49 | gt_btn_set_text(e->target, buffer); 50 | } 51 | 52 | 53 | /* global functions / API interface -------------------------------------*/ 54 | 55 | /** 56 | * @brief create a button, and click it will printf touch count. 57 | */ 58 | void gt_examples_button(void) 59 | { 60 | gt_obj_st * screen; 61 | screen = gt_obj_create(NULL); 62 | 63 | gt_obj_st * btn = gt_btn_create(screen); 64 | gt_obj_set_pos(btn, 0, 30); 65 | gt_obj_set_size(btn, 80, 40); 66 | gt_obj_add_event_cb(btn, btn_click_cb, GT_EVENT_TYPE_INPUT_RELEASED, NULL); 67 | 68 | gt_disp_load_scr(screen); 69 | } 70 | 71 | #endif 72 | /* end ------------------------------------------------------------------*/ 73 | -------------------------------------------------------------------------------- /examples/widgets/gt_example_checkbox.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_example_checkbox.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-09-29 18:58:51 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | 12 | #include "../gt_examples.h" 13 | #include "../../src/widgets/gt_checkbox.h" 14 | 15 | /* private define -------------------------------------------------------*/ 16 | #if GT_USE_EXAMPLES 17 | 18 | 19 | /* private typedef ------------------------------------------------------*/ 20 | 21 | 22 | 23 | /* static variables -----------------------------------------------------*/ 24 | 25 | 26 | 27 | /* macros ---------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* class ----------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* static functions -----------------------------------------------------*/ 36 | 37 | static void _gt_check_event_cb(gt_event_st * e) 38 | { 39 | printf("checkbox state: %s\n", gt_obj_get_state(e->target) ? "selected" : "unselected"); 40 | } 41 | 42 | 43 | /* global functions / API interface -------------------------------------*/ 44 | void gt_examples_checkbox(void) 45 | { 46 | gt_obj_st * screen; 47 | screen = gt_obj_create(NULL); 48 | 49 | gt_obj_st * checkbox = gt_checkbox_create(screen); 50 | gt_checkbox_set_text(checkbox, "Enabled"); 51 | gt_obj_set_pos(checkbox, 0, 0); 52 | gt_obj_set_size(checkbox, 80, 20); 53 | gt_obj_add_event_cb(checkbox, _gt_check_event_cb, GT_EVENT_TYPE_INPUT_RELEASED, NULL); 54 | 55 | gt_disp_load_scr(screen); 56 | } 57 | 58 | 59 | #endif 60 | /* end ------------------------------------------------------------------*/ 61 | -------------------------------------------------------------------------------- /examples/widgets/gt_example_img.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_example_img.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-10-10 10:26:29 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | 12 | #include "../gt_examples.h" 13 | #include "../../src/widgets/gt_img.h" 14 | #include "../../src/core/gt_event.h" 15 | 16 | 17 | /* private define -------------------------------------------------------*/ 18 | #if GT_USE_EXAMPLES 19 | 20 | 21 | /* private typedef ------------------------------------------------------*/ 22 | 23 | 24 | 25 | /* static variables -----------------------------------------------------*/ 26 | 27 | static gt_obj_st * _screen = NULL; 28 | static gt_obj_st * image = NULL; 29 | static gt_obj_st * image2 = NULL; 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* class ----------------------------------------------------------------*/ 36 | 37 | 38 | 39 | /* static functions -----------------------------------------------------*/ 40 | 41 | static void _image_one_cb(gt_event_st * e) { 42 | GT_LOGD(GT_LOG_TAG_EXTRA, "image one call back"); 43 | static int _cnt_1 = 0; 44 | gt_img_set_src(image, (_cnt_1++ % 2) ? "./2.png" : "./50x50.png"); 45 | gt_disp_load_scr(_screen); 46 | } 47 | 48 | static void _image_two_cb(gt_event_st * e) { 49 | GT_LOGD(GT_LOG_TAG_EXTRA, "image two call back"); 50 | static int _cnt_2 = 0; 51 | gt_img_set_src(image2, (_cnt_2++ % 2) ? "./50x50.png" : "./2.png"); 52 | gt_disp_load_scr(_screen); 53 | } 54 | /* global functions / API interface -------------------------------------*/ 55 | 56 | void gt_examples_img(void) 57 | { 58 | _screen = gt_obj_create(NULL); 59 | 60 | image = gt_img_create(_screen); 61 | gt_img_set_src(image, "./2.png"); 62 | gt_obj_set_pos(image, 0, 0); 63 | gt_obj_add_event_cb(image, _image_one_cb, GT_EVENT_TYPE_INPUT_RELEASED, NULL); 64 | 65 | image2 = gt_img_create(_screen); 66 | gt_img_set_src(image2, "./50x50.png"); 67 | gt_obj_set_pos(image2, 0, 100); 68 | gt_obj_add_event_cb(image2, _image_two_cb, GT_EVENT_TYPE_INPUT_RELEASED, NULL); 69 | 70 | gt_disp_load_scr(_screen); 71 | } 72 | 73 | 74 | #endif 75 | /* end ------------------------------------------------------------------*/ 76 | -------------------------------------------------------------------------------- /examples/widgets/gt_example_img_button.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_example_img_button.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-10-10 10:51:58 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "../gt_examples.h" 12 | #include "../../src/widgets/gt_imgbtn.h" 13 | 14 | 15 | /* private define -------------------------------------------------------*/ 16 | #if GT_USE_EXAMPLES 17 | 18 | 19 | /* private typedef ------------------------------------------------------*/ 20 | 21 | 22 | 23 | /* static variables -----------------------------------------------------*/ 24 | 25 | 26 | 27 | /* macros ---------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* class ----------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* static functions -----------------------------------------------------*/ 36 | 37 | 38 | 39 | /* global functions / API interface -------------------------------------*/ 40 | 41 | void gt_examples_img_button(void) 42 | { 43 | gt_obj_st * screen; 44 | screen = gt_obj_create(NULL); 45 | 46 | gt_obj_st * image_btn = gt_imgbtn_create(screen); 47 | gt_imgbtn_set_src(image_btn, "./2.png"); 48 | gt_imgbtn_set_src_press(image_btn, "./1.bmp"); 49 | gt_imgbtn_set_src_release(image_btn, "./2.png"); 50 | gt_obj_set_pos(image_btn, 100, 100); 51 | 52 | gt_disp_load_scr(screen); 53 | } 54 | 55 | 56 | #endif 57 | /* end ------------------------------------------------------------------*/ 58 | -------------------------------------------------------------------------------- /examples/widgets/gt_example_input.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_example_input.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-09-30 14:09:59 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | 12 | #include "../gt_examples.h" 13 | #include "../../src/core/gt_event.h" 14 | #include "../../src/widgets/gt_input.h" 15 | 16 | 17 | /* private define -------------------------------------------------------*/ 18 | #if GT_USE_EXAMPLES 19 | 20 | 21 | /* private typedef ------------------------------------------------------*/ 22 | 23 | 24 | 25 | /* static variables -----------------------------------------------------*/ 26 | 27 | 28 | 29 | /* macros ---------------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* class ----------------------------------------------------------------*/ 34 | 35 | 36 | 37 | /* static functions -----------------------------------------------------*/ 38 | 39 | static void _click_cb(gt_event_st * e) 40 | { 41 | gt_input_append_value(e->target, "test "); 42 | } 43 | 44 | 45 | /* global functions / API interface -------------------------------------*/ 46 | 47 | void gt_example_input(void) 48 | { 49 | gt_obj_st * screen; 50 | screen = gt_obj_create(NULL); 51 | 52 | gt_obj_st * input = gt_input_create(screen); 53 | gt_input_set_placeholder(input, "This is placeholder content."); 54 | gt_obj_set_pos(input, 0, 0); 55 | gt_obj_set_size(input, 180, 80); 56 | gt_obj_add_event_cb(input, _click_cb, GT_EVENT_TYPE_INPUT_RELEASED, NULL); 57 | 58 | gt_disp_load_scr(screen); 59 | } 60 | 61 | #endif 62 | /* end ------------------------------------------------------------------*/ 63 | -------------------------------------------------------------------------------- /examples/widgets/gt_example_keyboard.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaotongfont/GT-HMI-Engine/f4df4a90a7737d1ba3e11ed7d7bcad20b06d2ce5/examples/widgets/gt_example_keyboard.c -------------------------------------------------------------------------------- /examples/widgets/gt_example_label.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_example_label.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-10-10 11:35:27 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "../gt_examples.h" 12 | #include "../../src/widgets/gt_label.h" 13 | 14 | 15 | /* private define -------------------------------------------------------*/ 16 | #if GT_USE_EXAMPLES 17 | 18 | 19 | /* private typedef ------------------------------------------------------*/ 20 | 21 | 22 | 23 | /* static variables -----------------------------------------------------*/ 24 | 25 | 26 | 27 | /* macros ---------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* class ----------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* static functions -----------------------------------------------------*/ 36 | 37 | 38 | 39 | /* global functions / API interface -------------------------------------*/ 40 | void gt_examples_label(void) 41 | { 42 | gt_obj_st * screen; 43 | screen = gt_obj_create(NULL); 44 | 45 | gt_obj_st * label = gt_label_create(screen); 46 | gt_label_set_text(label, "This is label test."); 47 | gt_obj_set_pos(label, 0, 0); 48 | 49 | gt_disp_load_scr(screen); 50 | } 51 | 52 | 53 | #endif 54 | /* end ------------------------------------------------------------------*/ 55 | -------------------------------------------------------------------------------- /examples/widgets/gt_example_line.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_example_line.c 3 | * @author Li 4 | * @brief 5 | * @version 0.1 6 | * @date 2023-01-10 11:41:32 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "../gt_examples.h" 12 | #include "../../src/core/gt_event.h" 13 | #include "../../src/widgets/gt_btn.h" 14 | #include "../../src/widgets/gt_label.h" 15 | #include "../../src/widgets/gt_line.h" 16 | 17 | 18 | /* private define -------------------------------------------------------*/ 19 | #if GT_USE_EXAMPLES 20 | 21 | 22 | 23 | /* private typedef ------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* static variables -----------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* class ----------------------------------------------------------------*/ 36 | 37 | 38 | 39 | /* static functions -----------------------------------------------------*/ 40 | 41 | 42 | /* global functions / API interface -------------------------------------*/ 43 | 44 | /** 45 | * @brief create a line. 46 | */ 47 | void gt_examples_line(void) 48 | { 49 | gt_obj_st * screen; 50 | screen = gt_obj_create(NULL); 51 | 52 | gt_obj_st * line = gt_line_create(screen); 53 | 54 | gt_line_set_color(line,gt_color_blue()); 55 | gt_line_set_line_width(line,1); 56 | gt_line_set_start_point(line,100,100); 57 | gt_line_set_end_point(line,400,133); 58 | gt_disp_load_scr(screen); 59 | } 60 | 61 | #endif 62 | /* end ------------------------------------------------------------------*/ 63 | -------------------------------------------------------------------------------- /examples/widgets/gt_example_listview.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_example_listview.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-10-10 14:37:42 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "../gt_examples.h" 12 | #include "../../src/widgets/gt_listview.h" 13 | 14 | 15 | /* private define -------------------------------------------------------*/ 16 | #if GT_USE_EXAMPLES 17 | 18 | 19 | /* private typedef ------------------------------------------------------*/ 20 | 21 | 22 | 23 | /* static variables -----------------------------------------------------*/ 24 | 25 | 26 | 27 | /* macros ---------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* class ----------------------------------------------------------------*/ 32 | 33 | void _listview_event_cb(gt_event_st * e) 34 | { 35 | printf("listview event\n"); 36 | } 37 | 38 | 39 | /* static functions -----------------------------------------------------*/ 40 | void gt_examples_listview(void) 41 | { 42 | int i = 0; 43 | char * names[] = { "foo1", "foo2", "foo3", "foo4", "foo5", "foo6", "foo7" }; 44 | int length = sizeof(names) / sizeof(char *); 45 | 46 | gt_obj_st * screen; 47 | screen = gt_obj_create(NULL); 48 | 49 | gt_obj_st * listview = gt_listview_create(screen); 50 | for (i = 0; i < length; i++) { 51 | gt_listview_add_item(listview, names[i]); 52 | } 53 | gt_listview_set_selected_item_by_idx(listview, 2); 54 | gt_obj_set_pos(listview, 0, 0); 55 | gt_obj_set_size(listview, 120, 60); 56 | gt_obj_add_event_cb(listview, _listview_event_cb, GT_EVENT_TYPE_INPUT_RELEASED, NULL); 57 | 58 | gt_disp_load_scr(screen); 59 | } 60 | 61 | 62 | /* global functions / API interface -------------------------------------*/ 63 | 64 | 65 | #endif 66 | /* end ------------------------------------------------------------------*/ 67 | -------------------------------------------------------------------------------- /examples/widgets/gt_example_progress_bar.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_example_progress_bar.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-10-25 15:24:38 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "../gt_examples.h" 12 | #include "../../src/widgets/gt_progress_bar.h" 13 | 14 | 15 | 16 | /* private define -------------------------------------------------------*/ 17 | #if GT_USE_EXAMPLES 18 | 19 | 20 | /* private typedef ------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* static variables -----------------------------------------------------*/ 25 | static int value = 0; 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* class ----------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* static functions -----------------------------------------------------*/ 37 | static void _progress_bar_event_cb(gt_event_st * e) 38 | { 39 | gt_progress_bar_set_pos(e->target, ++value); 40 | if (value > gt_progress_bar_get_total(e->target)) { 41 | value = 0; 42 | } 43 | } 44 | 45 | /* global functions / API interface -------------------------------------*/ 46 | void gt_examples_progress_bar(void) 47 | { 48 | gt_obj_st * screen; 49 | 50 | screen = gt_obj_create(NULL); 51 | 52 | gt_obj_st * progress_bar = gt_progress_bar_create(screen); 53 | gt_progress_bar_set_start_end(progress_bar, 0, 200); 54 | gt_progress_bar_set_pos(progress_bar, value); 55 | 56 | gt_obj_set_pos(progress_bar, 0, 60); 57 | gt_obj_set_size(progress_bar, 380, 40); 58 | gt_obj_add_event_cb(progress_bar, _progress_bar_event_cb, GT_EVENT_TYPE_INPUT_PRESSING, NULL); 59 | 60 | gt_disp_load_scr(screen); 61 | } 62 | 63 | 64 | #endif 65 | /* end ------------------------------------------------------------------*/ 66 | -------------------------------------------------------------------------------- /examples/widgets/gt_example_roller.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_example_roller.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2023-12-12 11:10:18 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "gt_examples.h" 12 | #include "../../src/widgets/gt_roller.h" 13 | #include "../../src/widgets/gt_btn.h" 14 | #include "../../src/core/gt_event.h" 15 | #include "../../src/others/gt_log.h" 16 | 17 | 18 | /* private define -------------------------------------------------------*/ 19 | 20 | #if GT_USE_EXAMPLES 21 | 22 | 23 | /* private typedef ------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* static variables -----------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* class ----------------------------------------------------------------*/ 36 | 37 | 38 | 39 | /* static functions -----------------------------------------------------*/ 40 | 41 | static void gt_roller_prev_cb(gt_event_st * e) { 42 | gt_obj_st * target = (gt_obj_st * )e->user_data; 43 | GT_LOGD("", "prev"); 44 | gt_roller_go_prev(target); 45 | } 46 | 47 | static void gt_roller_next_cb(gt_event_st * e) { 48 | gt_obj_st * target = (gt_obj_st * )e->user_data; 49 | GT_LOGD("", "next"); 50 | gt_roller_go_next(target); 51 | } 52 | 53 | 54 | /* global functions / API interface -------------------------------------*/ 55 | 56 | void gt_examples_roller(void) 57 | { 58 | gt_obj_st * screen_home = gt_obj_create(NULL); 59 | gt_screen_set_bgcolor(screen_home, gt_color_hex(0xffffff)); 60 | gt_obj_set_pos(screen_home, 0, 0); 61 | 62 | gt_obj_st * roller = gt_roller_create(screen_home); 63 | gt_obj_set_pos(roller, 20, 100); 64 | // gt_roller_set_display_item_count(roller, 5); 65 | #if 0 66 | gt_roller_set_options(roller, 67 | "test0\ntest1\ntest2\ntest3\ntest4\ntest5\ntest6\ntest7\ntest8\ntest9\ntest10", 68 | GT_ROLLER_MODE_INFINITE); 69 | #else 70 | gt_roller_set_options(roller, 71 | "test0\ntest1\ntest2\ntest3\ntest4\ntest5\ntest6\ntest7\ntest8\ntest9\ntest10", 72 | GT_ROLLER_MODE_NORMAL); 73 | #endif 74 | // gt_roller_set_line_space(roller, 20); 75 | 76 | gt_obj_st * prev = gt_btn_create(screen_home); 77 | gt_obj_set_pos(prev, 0, 0); 78 | gt_btn_set_text(prev, "prev"); 79 | gt_obj_add_event_cb(prev, gt_roller_prev_cb, GT_EVENT_TYPE_INPUT_RELEASED, roller); 80 | 81 | gt_obj_st * next = gt_btn_create(screen_home); 82 | gt_obj_set_pos(next, 100, 0); 83 | gt_btn_set_text(next, "next"); 84 | gt_obj_add_event_cb(next, gt_roller_next_cb, GT_EVENT_TYPE_INPUT_RELEASED, roller); 85 | } 86 | 87 | 88 | #endif /** GT_USE_EXAMPLES */ 89 | /* end ------------------------------------------------------------------*/ 90 | -------------------------------------------------------------------------------- /gui.mk: -------------------------------------------------------------------------------- 1 | include $(HMI_DIR)/driver/gt_driver.mk 2 | 3 | include $(HMI_DIR)/src/core/gt_core.mk 4 | include $(HMI_DIR)/src/extra/gt_extra.mk 5 | include $(HMI_DIR)/src/font/gt_font.mk 6 | include $(HMI_DIR)/src/hal/gt_hal.mk 7 | include $(HMI_DIR)/src/widgets/gt_widgets.mk 8 | include $(HMI_DIR)/src/widgets/serial/gt_widgets_serial.mk 9 | include $(HMI_DIR)/src/others/gt_others.mk 10 | 11 | include $(HMI_DIR)/src/utils/gt_utils.mk 12 | 13 | include $(HMI_DIR)/src/extra/draw/gt_draw.mk 14 | include $(HMI_DIR)/src/extra/gif/gt_gif.mk 15 | include $(HMI_DIR)/src/extra/jpeg/gt_jpeg.mk 16 | include $(HMI_DIR)/src/extra/md4c/gt_md4c.mk 17 | include $(HMI_DIR)/src/extra/png/gt_png.mk 18 | include $(HMI_DIR)/src/extra/serial/gt_serial.mk 19 | 20 | include $(HMI_DIR)/examples/gt_examples.mk 21 | include $(HMI_DIR)/test/gt_test.mk 22 | -------------------------------------------------------------------------------- /images/图片按钮.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaotongfont/GT-HMI-Engine/f4df4a90a7737d1ba3e11ed7d7bcad20b06d2ce5/images/图片按钮.gif -------------------------------------------------------------------------------- /images/多国语言.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaotongfont/GT-HMI-Engine/f4df4a90a7737d1ba3e11ed7d7bcad20b06d2ce5/images/多国语言.gif -------------------------------------------------------------------------------- /images/幻灯片.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaotongfont/GT-HMI-Engine/f4df4a90a7737d1ba3e11ed7d7bcad20b06d2ce5/images/幻灯片.gif -------------------------------------------------------------------------------- /images/矢量字库.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaotongfont/GT-HMI-Engine/f4df4a90a7737d1ba3e11ed7d7bcad20b06d2ce5/images/矢量字库.gif -------------------------------------------------------------------------------- /images/矢量字库示例.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaotongfont/GT-HMI-Engine/f4df4a90a7737d1ba3e11ed7d7bcad20b06d2ce5/images/矢量字库示例.png -------------------------------------------------------------------------------- /images/组合.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaotongfont/GT-HMI-Engine/f4df4a90a7737d1ba3e11ed7d7bcad20b06d2ce5/images/组合.gif -------------------------------------------------------------------------------- /images/键盘.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaotongfont/GT-HMI-Engine/f4df4a90a7737d1ba3e11ed7d7bcad20b06d2ce5/images/键盘.gif -------------------------------------------------------------------------------- /images/高通GitHub运营版面logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaotongfont/GT-HMI-Engine/f4df4a90a7737d1ba3e11ed7d7bcad20b06d2ce5/images/高通GitHub运营版面logo.png -------------------------------------------------------------------------------- /sources/gif/button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaotongfont/GT-HMI-Engine/f4df4a90a7737d1ba3e11ed7d7bcad20b06d2ce5/sources/gif/button.gif -------------------------------------------------------------------------------- /sources/gt-gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gaotongfont/GT-HMI-Engine/f4df4a90a7737d1ba3e11ed7d7bcad20b06d2ce5/sources/gt-gui.png -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(src) 2 | 3 | include_directories( 4 | ${PROJECT_SOURCE_DIR}/*/*.h 5 | ${PROJECT_SOURCE_DIR}/*/*/*.h 6 | ) 7 | 8 | file(GLOB SRC_FILES 9 | ${PROJECT_SOURCE_DIR}/../driver/*.c 10 | ${PROJECT_SOURCE_DIR}/*/*.c 11 | ${PROJECT_SOURCE_DIR}/*/*/*.c 12 | ) 13 | 14 | message(STATUS "Src code: [${SRC_FILES}]") 15 | 16 | add_library(gt_gui_lib_static STATIC ${SRC_FILES}) 17 | add_library(gt_gui_lib_dynamic SHARED ${SRC_FILES}) 18 | 19 | message(STATUS "Install path: [${CMAKE_LIBRARY_OUTPUT_DIRECTORY}]") 20 | 21 | set_target_properties(gt_gui_lib_static PROPERTIES LINKER_LANGUAGE C 22 | OUTPUT_NAME "gt_gui_static" 23 | ) 24 | set_target_properties(gt_gui_lib_dynamic PROPERTIES VERSION 1.2 SOVERSION 1) 25 | set_target_properties(gt_gui_lib_dynamic PROPERTIES LINKER_LANGUAGE C 26 | OUTPUT_NAME "gt_gui_dynamic" 27 | ) 28 | 29 | set(LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) 30 | 31 | -------------------------------------------------------------------------------- /src/core/gt_core.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/core/*.c)) 2 | 3 | 4 | DEPPATH += --dep-path $(HMI_DIR)/src/core 5 | VPATH += :$(HMI_DIR)/src/core 6 | 7 | CFLAGS += "-I$(HMI_DIR)/src/core" 8 | -------------------------------------------------------------------------------- /src/core/gt_graph_base.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_graph_base.c 3 | * @author yongg 4 | * @brief Low-level rendering interface 5 | * @version 0.1 6 | * @date 2022-05-11 15:02:43 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "stdlib.h" 12 | #include "stdbool.h" 13 | 14 | #include "gt_graph_base.h" 15 | #include "../hal/gt_hal_disp.h" 16 | #include "gt_mem.h" 17 | #include "../others/gt_math.h" 18 | #include "../others/gt_log.h" 19 | #include "../widgets/gt_obj.h" 20 | 21 | 22 | /* private define -------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* private typedef ------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* static variables -----------------------------------------------------*/ 31 | 32 | 33 | 34 | /* macros ---------------------------------------------------------------*/ 35 | 36 | 37 | 38 | /* static functions -----------------------------------------------------*/ 39 | 40 | 41 | 42 | /* global functions / API interface -------------------------------------*/ 43 | 44 | void gt_graph_init_rect_attr(gt_attr_rect_st * rect_attr) 45 | { 46 | gt_memset(rect_attr, 0, sizeof(gt_attr_rect_st)); 47 | rect_attr->bg_color = gt_color_black(); 48 | rect_attr->bg_opa = GT_OPA_COVER; 49 | rect_attr->border_color = gt_color_black(); 50 | rect_attr->border_opa = GT_OPA_COVER; 51 | } 52 | 53 | 54 | /* end ------------------------------------------------------------------*/ 55 | -------------------------------------------------------------------------------- /src/core/gt_handler.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_handler.h 3 | * @author yongg 4 | * @brief GUI task management interface 5 | * @version 0.1 6 | * @date 2022-05-11 15:07:33 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_HANDLER_H_ 10 | #define _GT_HANDLER_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | /** 23 | * @brief 主版本号 24 | */ 25 | #define GT_HMI_ENGINE_MAJOR_VERSION 1 26 | /** 27 | * @brief 次版本号 28 | */ 29 | #define GT_HMI_ENGINE_MINOR_VERSION 3 30 | /** 31 | * @brief 修订号 32 | */ 33 | #define GT_HMI_ENGINE_PATCH_VERSION 5 34 | 35 | /* typedef --------------------------------------------------------------*/ 36 | 37 | 38 | 39 | /* macros ---------------------------------------------------------------*/ 40 | 41 | 42 | 43 | /* global functions / API interface -------------------------------------*/ 44 | 45 | /** 46 | * @brief GT-HMI all init 47 | */ 48 | void gt_init(void); 49 | 50 | /** 51 | * @brief GT-HMI task handler function called by task 52 | */ 53 | void gt_task_handler(void); 54 | 55 | #ifdef __cplusplus 56 | } /*extern "C"*/ 57 | #endif 58 | 59 | #endif //!_GT_HANDLER_H_ 60 | -------------------------------------------------------------------------------- /src/core/gt_indev.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_indev.h 3 | * @author yongg 4 | * @brief input device handler 5 | * @version 0.1 6 | * @date 2022-06-06 14:06:12 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_INDEV_H_ 10 | #define _GT_INDEV_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../hal/gt_hal_indev.h" 18 | #include "./gt_timer.h" 19 | 20 | 21 | /* define ---------------------------------------------------------------*/ 22 | 23 | 24 | 25 | /* typedef --------------------------------------------------------------*/\ 26 | #if GT_USE_UD_LR_TO_CONTROL_FOCUS_EN 27 | typedef enum{ 28 | GT_FOCUS_DIR_RIGHT = 0, 29 | GT_FOCUS_DIR_LEFT, 30 | GT_FOCUS_DIR_DOWN, 31 | GT_FOCUS_DIR_UP, 32 | }gt_focus_dir_et; 33 | #endif 34 | 35 | /* macros ---------------------------------------------------------------*/ 36 | 37 | 38 | 39 | /* global functions / API interface -------------------------------------*/ 40 | 41 | /** 42 | * @brief Get indev button key value 43 | * 44 | * @return uint32_t 45 | */ 46 | uint32_t gt_indev_get_key(void); 47 | 48 | /** 49 | * @brief Get physical point value 50 | * 51 | * @return gt_point_st 52 | */ 53 | gt_point_st gt_indev_get_point(void); 54 | 55 | /** 56 | * @brief get click first point 57 | * 58 | * @param indev input device 59 | * @param point click first point 60 | */ 61 | void gt_indev_get_point_act(const gt_indev_st * indev, gt_point_st * point); 62 | 63 | /** 64 | * @brief get clicking newly point 65 | * 66 | * @param indev input device 67 | * @param point clicking newly point 68 | */ 69 | void gt_indev_get_point_newly(const gt_indev_st * indev, gt_point_st * point); 70 | 71 | /** 72 | * @brief Get the gesture of the input device 73 | * 74 | * @param indev input device 75 | * @return gt_dir_et Direction of gesture 76 | */ 77 | gt_dir_et gt_indev_get_gesture(const gt_indev_st * indev); 78 | 79 | /** 80 | * @brief Input processing handle 81 | */ 82 | void gt_indev_handler(struct _gt_timer_s * timer); 83 | 84 | /** 85 | * @brief disabled input device 86 | * 87 | * @param disabled 0: disabled, 1: enabled [default: 1] 88 | */ 89 | void gt_indev_set_enabled(bool enabled); 90 | 91 | /** 92 | * @brief 93 | * 94 | * @return true 95 | * @return false 96 | */ 97 | bool gt_indev_is_enabled(void); 98 | 99 | bool _gt_indev_remove_want_delate_target(gt_obj_st * target); 100 | 101 | #if GT_USE_UD_LR_TO_CONTROL_FOCUS_EN 102 | 103 | /** 104 | * @brief Release focus lock 105 | * 106 | */ 107 | void gt_indev_release_focus_lock(void); 108 | #endif 109 | 110 | 111 | #if GT_INDEV_SIMULATE_POINTER 112 | void gt_indev_simulate_handler(gt_indev_state_et state, gt_size_t x, gt_size_t y); 113 | #endif 114 | 115 | #ifdef __cplusplus 116 | } /*extern "C"*/ 117 | #endif 118 | 119 | #endif //!_GT_INDEV_H_ 120 | -------------------------------------------------------------------------------- /src/core/gt_layout.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_layout.h 3 | * @author Feyoung 4 | * @brief Logical handling of layers 5 | * @version 0.1 6 | * @date 2024-03-29 19:53:33 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_LAYOUT_H_ 10 | #define _GT_LAYOUT_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../widgets/gt_obj.h" 18 | 19 | 20 | 21 | /* define ---------------------------------------------------------------*/ 22 | 23 | 24 | 25 | /* typedef --------------------------------------------------------------*/ 26 | 27 | 28 | 29 | /* macros ---------------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* class ----------------------------------------------------------------*/ 34 | 35 | 36 | 37 | /* global functions / API interface -------------------------------------*/ 38 | 39 | /** 40 | * @brief Arrange controls in a row arrangement, 41 | * the width of the control is the width of the control itself, 42 | * when object prop setup row_layout = true, Reverse order needs 43 | * to be set grow_invert = true. 44 | * 45 | * @param obj The target object 46 | */ 47 | void gt_layout_row_grow(gt_obj_st * obj); 48 | 49 | #if GT_USE_WIDGET_LAYOUT 50 | void gt_layout_init(gt_obj_st * obj, gt_obj_container_st const * const container); 51 | 52 | gt_res_t gt_layout_update_core(gt_obj_st * obj); 53 | 54 | enum gt_layout_type_e gt_layout_get_type(gt_obj_st * obj); 55 | 56 | bool gt_layout_is_type(gt_obj_st * obj, enum gt_layout_type_e type); 57 | #endif 58 | 59 | #ifdef __cplusplus 60 | } /*extern "C"*/ 61 | #endif 62 | 63 | #endif //!_GT_LAYOUT_H_ 64 | -------------------------------------------------------------------------------- /src/core/gt_obj_pos.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_obj_pos.h 3 | * @author yongg 4 | * @brief Set object position function 5 | * @version 0.1 6 | * @date 2022-06-15 14:34:27 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_OBJ_POS_H_ 10 | #define _GT_OBJ_POS_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "stdint.h" 18 | #include 19 | #include "../gt_conf.h" 20 | #include "../widgets/gt_obj.h" 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* typedef --------------------------------------------------------------*/ 27 | typedef struct gt_obj_change_s { 28 | gt_obj_st * src; 29 | gt_obj_st * dst; 30 | }gt_obj_change_st; 31 | 32 | 33 | 34 | /* macros ---------------------------------------------------------------*/ 35 | 36 | 37 | 38 | /* global functions / API interface -------------------------------------*/ 39 | 40 | /** 41 | * @brief area value copy 42 | * 43 | * @param dst dst area 44 | * @param src src area 45 | */ 46 | void gt_area_copy(gt_area_st * dst, gt_area_st const * const src); 47 | 48 | /** 49 | * @brief find smallest clicked obj from parent 50 | * 51 | * @param scr_or_top Screen object or layer top object 52 | * @param point click point 53 | * @return gt_obj_st* smallest and clicked obj in parent 54 | */ 55 | gt_obj_st * gt_find_clicked_obj_by_point(gt_obj_st * scr_or_top, gt_point_st * point); 56 | 57 | gt_obj_st* gt_find_clicked_obj_by_focus(gt_obj_st * parent); 58 | void gt_obj_focus_change_display(gt_obj_change_st * chg); 59 | 60 | #if GT_USE_UD_LR_TO_CONTROL_FOCUS_EN 61 | gt_obj_change_st gt_obj_focus_change(gt_obj_st * cur_obj, uint8_t dir); 62 | #else 63 | gt_obj_change_st gt_obj_next_focus_change(gt_obj_st * cur_obj); 64 | gt_obj_change_st gt_obj_prev_focus_change(gt_obj_st * cur_obj); 65 | gt_obj_change_st gt_obj_into_focus_change(gt_obj_st * cur_obj); 66 | gt_obj_change_st gt_obj_out_focus_change(gt_obj_st * cur_obj); 67 | #endif 68 | 69 | /** 70 | * @brief check obj is in the disp screen now 71 | * 72 | * @param obj need check obj 73 | * @return true yes 74 | * @return false no 75 | */ 76 | bool gt_obj_check_scr(gt_obj_st * obj); 77 | 78 | void gt_obj_get_click_point_by_phy_point(gt_obj_st * obj, gt_point_st * point_phy, gt_point_st * point_ret); 79 | 80 | #ifdef __cplusplus 81 | } /*extern "C"*/ 82 | #endif 83 | 84 | #endif //!_GT_OBJ_POS_H_ 85 | -------------------------------------------------------------------------------- /src/core/gt_obj_scroll.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_obj_scroll.h 3 | * @author yongg 4 | * @brief Scroll bar animation 5 | * @version 0.1 6 | * @date 2022-08-31 14:25:09 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_OBJ_SCROLL_H_ 10 | #define _GT_OBJ_SCROLL_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "stdint.h" 18 | #include "../others/gt_types.h" 19 | #include "../widgets/gt_obj.h" 20 | 21 | /* define ---------------------------------------------------------------*/ 22 | 23 | 24 | 25 | /* typedef --------------------------------------------------------------*/ 26 | typedef enum{ 27 | GT_ANIM_OFF = 0, 28 | GT_ANIM_ON, 29 | }gt_anim_enable_et; 30 | 31 | 32 | /* macros ---------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* global functions / API interface -------------------------------------*/ 37 | 38 | /** 39 | * @brief scroll obj to position x,y 40 | * 41 | * @param obj obj 42 | * @param dx x coordinate of virtual screen object 43 | * @param dy y coordinate of virtual screen object 44 | * @param en enable scroll anim 45 | */ 46 | void gt_obj_scroll_to(struct gt_obj_s * obj, gt_size_t dx, gt_size_t dy, gt_anim_enable_et en); 47 | 48 | /** 49 | * @brief scroll obj to position x 50 | * 51 | * @param obj obj 52 | * @param x x coordinate of virtual screen object 53 | * @param en enable scroll anim 54 | */ 55 | void gt_obj_scroll_to_x(struct gt_obj_s * obj, gt_size_t x, gt_anim_enable_et en); 56 | 57 | /** 58 | * @brief scroll obj to position y 59 | * 60 | * @param obj obj 61 | * @param y y coordinate of virtual screen object 62 | * @param en enable scroll anim 63 | */ 64 | void gt_obj_scroll_to_y(struct gt_obj_s * obj, gt_size_t y, gt_anim_enable_et en); 65 | 66 | 67 | gt_size_t gt_obj_scroll_get_x(gt_obj_st * obj); 68 | gt_size_t gt_obj_scroll_get_y(gt_obj_st * obj); 69 | 70 | void _gt_obj_scroll_internal(gt_obj_st * obj); 71 | 72 | void _gt_obj_set_process_point(gt_obj_st * obj, gt_point_st * point); 73 | void _gt_obj_set_process_scroll_xy(gt_obj_st * obj, gt_size_t x_scroll, gt_size_t y_scroll); 74 | 75 | #ifdef __cplusplus 76 | } /*extern "C"*/ 77 | #endif 78 | 79 | #endif //!_GT_OBJ_SCROLL_H_ 80 | -------------------------------------------------------------------------------- /src/core/gt_refr.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_refr.c 3 | * @author yongg 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-08-12 10:04:48 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "gt_refr.h" 12 | #include "gt_refr.h" 13 | #include "../gt_conf.h" 14 | #include "../widgets/gt_obj.h" 15 | #include "../others/gt_log.h" 16 | #include "../others/gt_area.h" 17 | #include "gt_obj_pos.h" 18 | #include "../hal/gt_hal_disp.h" 19 | #include "../hal/gt_hal_tick.h" 20 | #include "gt_disp.h" 21 | #include "../extra/draw/gt_draw_blend.h" 22 | #include "../core/gt_draw.h" 23 | 24 | 25 | /* private define -------------------------------------------------------*/ 26 | 27 | 28 | 29 | /* private typedef ------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* static variables -----------------------------------------------------*/ 34 | 35 | 36 | 37 | /* macros ---------------------------------------------------------------*/ 38 | 39 | 40 | 41 | /* static functions -----------------------------------------------------*/ 42 | 43 | 44 | 45 | /* global functions / API interface -------------------------------------*/ 46 | void gt_refr_timer(void) 47 | { 48 | gt_disp_st * disp = gt_disp_get_default(); 49 | gt_area_st * area = NULL; 50 | #if GT_REFR_AREA_ALIGN_HOR || GT_REFR_AREA_ALIGN_VER 51 | uint16_t align_val = 0; 52 | #endif 53 | GT_CHECK_BACK(disp); 54 | if (_gt_disp_refr_check(disp)) { 55 | #if GT_USE_DISPLAY_PREF_MSG 56 | uint32_t start = gt_tick_get(); 57 | #endif 58 | area = _gt_disp_refr_get_area(disp); 59 | GT_CHECK_BACK(area); 60 | #if GT_REFR_AREA_ALIGN_HOR 61 | align_val = gt_abs(area->x % GT_REFR_AREA_ALIGN_HOR_PIXEL); 62 | if (align_val) { 63 | area->x -= align_val; 64 | area->w = ((uint16_t)(align_val + GT_REFR_AREA_ALIGN_HOR_PIXEL + area->w) / GT_REFR_AREA_ALIGN_HOR_PIXEL) * GT_REFR_AREA_ALIGN_HOR_PIXEL; 65 | } 66 | #endif 67 | 68 | #if GT_REFR_AREA_ALIGN_VER 69 | align_val = gt_abs(area->y % GT_REFR_AREA_ALIGN_VER_PIXEL); 70 | if (align_val) { 71 | area->y -= align_val; 72 | area->h = ((uint16_t)(align_val + GT_REFR_AREA_ALIGN_VER_PIXEL + area->h) / GT_REFR_AREA_ALIGN_VER_PIXEL) * GT_REFR_AREA_ALIGN_VER_PIXEL; 73 | } 74 | #endif 75 | gt_disp_ref_area(area); 76 | _gt_disp_refr_area_pop(disp); 77 | 78 | #if GT_USE_DISPLAY_PREF_MSG 79 | if( (gt_tick_get() - start) > 1 ) { 80 | GT_LOGD(GT_LOG_TAG_GUI, "refr timer: %d ms", gt_tick_get() - start ); 81 | } 82 | #endif 83 | } else { 84 | // gt_disp_invalid_area(NULL); 85 | } 86 | } 87 | 88 | 89 | /* end ------------------------------------------------------------------*/ 90 | -------------------------------------------------------------------------------- /src/core/gt_refr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_refr.h 3 | * @author yongg 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-08-12 10:05:04 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_REFR_H_ 10 | #define _GT_REFR_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_draw.h" 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | #ifndef GT_REFR_AREA_ALIGN_HOR 22 | /** 23 | * @brief Refresh area resize to alignment horizontal, x or width will be 24 | * aligned to the multiple of GT_REFR_AREA_ALIGN_HOR_PIXEL 25 | */ 26 | #define GT_REFR_AREA_ALIGN_HOR 0 27 | #endif 28 | 29 | #if GT_REFR_AREA_ALIGN_HOR 30 | /** 31 | * @brief The pixel value for horizontal alignment 32 | * such as: x: 3, w: 8, GT_REFR_AREA_ALIGN_HOR_PIXEL: 4 33 | * result: x will be 0, w will be 12 = (3 + 4 + 8) / 4 * 4. 34 | */ 35 | #define GT_REFR_AREA_ALIGN_HOR_PIXEL 0 36 | #endif 37 | 38 | #ifndef GT_REFR_AREA_ALIGN_VER 39 | /** 40 | * @brief Refresh area resize to alignment vertical, y or height will be 41 | * aligned to the multiple of GT_REFR_AREA_ALIGN_VER_PIXEL 42 | */ 43 | #define GT_REFR_AREA_ALIGN_VER 0 44 | #endif 45 | 46 | #if GT_REFR_AREA_ALIGN_VER 47 | /** 48 | * @brief The pixel value for vertical alignment 49 | * such as: y: 3, h: 8, GT_REFR_AREA_ALIGN_VER_PIXEL: 4 50 | * result: y will be 0, h will be 12 = (3 + 4 + 8) / 4 * 4. 51 | */ 52 | #define GT_REFR_AREA_ALIGN_VER_PIXEL 0 53 | #endif 54 | 55 | 56 | /* typedef --------------------------------------------------------------*/ 57 | 58 | 59 | 60 | /* macros ---------------------------------------------------------------*/ 61 | 62 | 63 | 64 | /* global functions / API interface -------------------------------------*/ 65 | void gt_refr_timer(void); 66 | 67 | 68 | 69 | #ifdef __cplusplus 70 | } /*extern "C"*/ 71 | 72 | #endif 73 | 74 | #endif //!_GT_REFR_H_ 75 | -------------------------------------------------------------------------------- /src/extra/draw/gt_draw.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/extra/draw/*.c)) 2 | 3 | DEPPATH += --dep-path $(HMI_DIR)/src/extra/draw 4 | VPATH += :$(HMI_DIR)/src/extra/draw 5 | 6 | CFLAGS += "-I$(HMI_DIR)/src/extra/draw" 7 | -------------------------------------------------------------------------------- /src/extra/draw/gt_draw_blend.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_draw_blend.h 3 | * @author yongg 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-08-10 19:43:01 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_DRAW_BLEND_H_ 10 | #define _GT_DRAW_BLEND_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../../core/gt_graph_base.h" 18 | #include "../../hal/gt_hal_disp.h" 19 | #include "../../font/gt_font.h" 20 | 21 | /* define ---------------------------------------------------------------*/ 22 | #ifndef GT_DRAW_BLEND_ALIGN 23 | /** 24 | * @brief 1[default]: align the buffer to 4 bytes 25 | */ 26 | #define GT_DRAW_BLEND_ALIGN 01 27 | #endif 28 | 29 | 30 | 31 | /* typedef --------------------------------------------------------------*/ 32 | typedef struct _gt_draw_blend_dsc_s { 33 | gt_area_st * dst_area; /** dst area, draw temp cache */ 34 | gt_color_t * dst_buf; /** blend dst color */ 35 | 36 | gt_area_st * mask_area; /** alpha data display area */ 37 | gt_opa_t * mask_buf; /** opa / alpha buffer */ 38 | gt_color_t color_fill; /*blend color*/ 39 | 40 | gt_area_st * view_area; /** The area(window) within the control where characters or element can be displayed only */ 41 | 42 | gt_opt_t opa; /** value of the overall opacity */ 43 | }gt_draw_blend_dsc_st; 44 | 45 | typedef struct _gt_draw_blend_fill_cache_s { 46 | gt_color_t * color_dst_p; 47 | gt_color_t * color_src_p; 48 | gt_opa_t * mask_buf_p; 49 | gt_area_st area_intersect; 50 | gt_color_t color; 51 | uint16_t width_src; 52 | uint16_t width_buf; 53 | gt_opa_t opa; 54 | }_gt_draw_blend_fill_cache_st; 55 | 56 | /* macros ---------------------------------------------------------------*/ 57 | 58 | 59 | 60 | /* global functions / API interface -------------------------------------*/ 61 | void gt_draw_blend(struct _gt_draw_ctx_s * draw_ctx, const gt_draw_blend_dsc_st * dsc); 62 | 63 | void gt_draw_blend_text(struct _gt_draw_ctx_s *draw_ctx, const gt_draw_blend_dsc_st * dsc, 64 | uint16_t font_size, uint16_t dot_byte, uint8_t gray, const uint8_t* res, gt_font_style_st font_style); 65 | #ifdef __cplusplus 66 | } /*extern "C"*/ 67 | #endif 68 | 69 | #endif //!_GT_DRAW_BLEND_H_ 70 | -------------------------------------------------------------------------------- /src/extra/draw/gt_draw_blend_with_argb888.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_draw_blend_with_argb888.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-06-04 21:31:16 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_DRAW_BLEND_WITH_ARGB888_H_ 10 | #define _GT_DRAW_BLEND_WITH_ARGB888_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "./gt_draw_blend.h" 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* typedef --------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* class ----------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* global functions / API interface -------------------------------------*/ 37 | void gt_draw_blend_with_argb888_opacity(_gt_draw_blend_fill_cache_st const * const fc); 38 | 39 | void gt_draw_blend_with_argb888_no_opacity(_gt_draw_blend_fill_cache_st const * const fc); 40 | 41 | 42 | 43 | #ifdef __cplusplus 44 | } /*extern "C"*/ 45 | #endif 46 | 47 | #endif //!_GT_DRAW_BLEND_WITH_ARGB888_H_ 48 | -------------------------------------------------------------------------------- /src/extra/draw/gt_draw_blend_with_rgb565.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_draw_blend_with_rgb565.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-06-04 21:31:27 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_DRAW_BLEND_WITH_RGB565_H_ 10 | #define _GT_DRAW_BLEND_WITH_RGB565_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "./gt_draw_blend.h" 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* typedef --------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* class ----------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* global functions / API interface -------------------------------------*/ 37 | void gt_draw_blend_with_rgb565_opacity(_gt_draw_blend_fill_cache_st const * const fc); 38 | 39 | void gt_draw_blend_with_rgb565_no_opacity(_gt_draw_blend_fill_cache_st const * const fc); 40 | 41 | #ifdef __cplusplus 42 | } /*extern "C"*/ 43 | #endif 44 | 45 | #endif //!_GT_DRAW_BLEND_WITH_RGB565_H_ 46 | -------------------------------------------------------------------------------- /src/extra/draw/gt_draw_blend_with_rgb888.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_draw_blend_with_rgb888.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-06-05 21:54:43 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_DRAW_BLEND_WITH_RGB888_H_ 10 | #define _GT_DRAW_BLEND_WITH_RGB888_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "./gt_draw_blend.h" 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* typedef --------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* class ----------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* global functions / API interface -------------------------------------*/ 37 | void gt_draw_blend_with_rgb888_opacity(_gt_draw_blend_fill_cache_st const * const fc); 38 | 39 | void gt_draw_blend_with_rgb888_no_opacity(_gt_draw_blend_fill_cache_st const * const fc); 40 | 41 | 42 | 43 | #ifdef __cplusplus 44 | } /*extern "C"*/ 45 | #endif 46 | 47 | #endif //!_GT_DRAW_BLEND_WITH_RGB888_H_ 48 | -------------------------------------------------------------------------------- /src/extra/gif/gifdec.h: -------------------------------------------------------------------------------- 1 | #ifndef GIFDEC_H 2 | #define GIFDEC_H 3 | 4 | #include 5 | #include "../../gt_conf.h" 6 | 7 | #if GT_USE_GIF 8 | 9 | #include "../../others/gt_types.h" 10 | #include "../../core/gt_fs.h" 11 | 12 | #if GT_USE_FILE_HEADER 13 | #include "../../hal/gt_hal_file_header.h" 14 | #endif 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | typedef struct gd_Palette { 21 | int size; 22 | uint8_t colors[0x100 * 3]; 23 | } gd_Palette; 24 | 25 | typedef struct gd_GCE { 26 | uint16_t delay; 27 | uint8_t tindex; 28 | uint8_t disposal; 29 | int input; 30 | int transparency; 31 | } gd_GCE; 32 | 33 | typedef struct gd_GIF { 34 | gt_fs_fp_st * fd; 35 | uint32_t anim_start; 36 | uint16_t width; 37 | uint16_t height; 38 | uint16_t depth; 39 | uint16_t loop_count; 40 | gd_GCE gce; 41 | gd_Palette *palette; 42 | gd_Palette lct, gct; 43 | void (*plain_text)( 44 | struct gd_GIF *gif, uint16_t tx, uint16_t ty, 45 | uint16_t tw, uint16_t th, uint8_t cw, uint8_t ch, 46 | uint8_t fg, uint8_t bg 47 | ); 48 | void (*comment)(struct gd_GIF *gif); 49 | void (*application)(struct gd_GIF *gif, char id[8], char auth[3]); 50 | uint16_t fx, fy, fw, fh; 51 | uint8_t bgindex; 52 | uint8_t *canvas, *frame, *mask; 53 | } gd_GIF; 54 | 55 | gd_GIF * gd_open_gif(const char *fname); 56 | 57 | #if GT_USE_FILE_HEADER 58 | gd_GIF * gd_fh_open_gif(gt_file_header_param_st const * const file_header); 59 | #endif 60 | 61 | #if GT_USE_DIRECT_ADDR 62 | gd_GIF * gd_direct_addr_open_gif(gt_addr_t addr); 63 | #endif 64 | 65 | int gd_get_frame(gd_GIF *gif); 66 | void gd_render_frame(gd_GIF *gif, uint8_t *buffer, uint8_t * mask); 67 | int gd_is_bgcolor(gd_GIF *gif, uint8_t color[3]); 68 | void gd_rewind(gd_GIF *gif); 69 | void gd_close_gif(gd_GIF *gif); 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | 75 | #endif /** GT_USE_GIF */ 76 | 77 | #endif /* GIFDEC_H */ 78 | -------------------------------------------------------------------------------- /src/extra/gif/gt_gif.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/extra/gif/*.c)) 2 | 3 | DEPPATH += --dep-path $(HMI_DIR)/src/extra/gif 4 | VPATH += :$(HMI_DIR)/src/extra/gif 5 | 6 | CFLAGS += "-I$(HMI_DIR)/src/extra/gif" 7 | 8 | -------------------------------------------------------------------------------- /src/extra/gt_extra.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_extra.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-08-17 14:09:08 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "gt_extra.h" 12 | #include "stddef.h" 13 | #include "../others/gt_gc.h" 14 | 15 | #if GT_USE_PNG 16 | #include "./png/gt_png.h" 17 | #endif 18 | 19 | #if GT_USE_SJPG 20 | #include "./jpeg/gt_sjpg.h" 21 | #endif 22 | 23 | 24 | /* private define -------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* private typedef ------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* static variables -----------------------------------------------------*/ 33 | 34 | 35 | 36 | /* macros ---------------------------------------------------------------*/ 37 | 38 | 39 | 40 | /* class ----------------------------------------------------------------*/ 41 | 42 | 43 | 44 | /* static functions -----------------------------------------------------*/ 45 | 46 | 47 | 48 | /* global functions / API interface -------------------------------------*/ 49 | 50 | /** 51 | * @brief extra function init 52 | */ 53 | void _gt_extra_init(void) 54 | { 55 | #if GT_USE_EXTRA_FULL_IMG_BUFFER 56 | gt_gc_set_full_img_buffer(NULL, 0); 57 | #endif 58 | 59 | #if GT_USE_PNG 60 | gt_png_init(); 61 | #endif 62 | 63 | #if GT_USE_SJPG 64 | gt_sjpg_init(); 65 | #endif 66 | 67 | } 68 | 69 | 70 | /* end ------------------------------------------------------------------*/ 71 | -------------------------------------------------------------------------------- /src/extra/gt_extra.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_extra.h 3 | * @author Feyoung 4 | * @brief Extended functionality 5 | * @version 0.1 6 | * @date 2022-08-17 14:09:02 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_EXTRA_H_ 10 | #define _GT_EXTRA_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../gt_conf.h" 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* typedef --------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* class ----------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* global functions / API interface -------------------------------------*/ 37 | 38 | void _gt_extra_init(void); 39 | 40 | 41 | #ifdef __cplusplus 42 | } /*extern "C"*/ 43 | #endif 44 | 45 | #endif //!_GT_EXTRA_H_ 46 | -------------------------------------------------------------------------------- /src/extra/gt_extra.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/extra/*.c)) 2 | 3 | # extra 4 | DEPPATH += --dep-path $(HMI_DIR)/src/extra 5 | VPATH += :$(HMI_DIR)/src/extra 6 | 7 | CFLAGS += "-I$(HMI_DIR)/src/extra" 8 | -------------------------------------------------------------------------------- /src/extra/jpeg/gt_jpeg.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/extra/jpeg/*.c)) 2 | 3 | DEPPATH += --dep-path $(HMI_DIR)/src/extra/jpeg 4 | VPATH += :$(HMI_DIR)/src/extra/jpeg 5 | 6 | CFLAGS += "-I$(HMI_DIR)/src/extra/jpeg" 7 | 8 | -------------------------------------------------------------------------------- /src/extra/jpeg/gt_sjpg.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_sjpg.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2023-10-23 15:47:07 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SJPG_H_ 10 | #define _GT_SJPG_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../../gt_conf.h" 18 | 19 | #if GT_USE_SJPG 20 | #include "../../others/gt_types.h" 21 | 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* typedef --------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* class ----------------------------------------------------------------*/ 36 | 37 | 38 | 39 | /* global functions / API interface -------------------------------------*/ 40 | /** 41 | * @brief jpg / sjpg image decoder init, register to list. 42 | */ 43 | void gt_sjpg_init(void); 44 | 45 | 46 | #endif /** GT_USE_SJPG */ 47 | 48 | #ifdef __cplusplus 49 | } /*extern "C"*/ 50 | #endif 51 | 52 | #endif //!_GT_SJPG_H_ 53 | -------------------------------------------------------------------------------- /src/extra/jpeg/tjpgdcnf.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------*/ 2 | /* TJpgDec System Configurations R0.03 */ 3 | /*----------------------------------------------*/ 4 | #include "../../gt_conf.h" 5 | 6 | #define JD_SZBUF 512 7 | /* Specifies size of stream input buffer */ 8 | 9 | #if GT_COLOR_DEPTH == 32 10 | #define JD_FORMAT 0 11 | #elif GT_COLOR_DEPTH == 16 12 | #define JD_FORMAT 1 13 | #elif GT_COLOR_DEPTH == 8 14 | #define JD_FORMAT 2 15 | #elif GT_COLOR_DEPTH == 1 16 | #define JD_FORMAT 2 17 | #endif 18 | /* Specifies output pixel format. 19 | / 0: RGB888 (24-bit/pix) 20 | / 1: RGB565 (16-bit/pix) 21 | / 2: Grayscale (8-bit/pix) 22 | */ 23 | 24 | #define JD_USE_SCALE 1 25 | /* Switches output descaling feature. 26 | / 0: Disable 27 | / 1: Enable 28 | */ 29 | 30 | #define JD_TBLCLIP 1 31 | /* Use table conversion for saturation arithmetic. A bit faster, but increases 1 KB of code size. 32 | / 0: Disable 33 | / 1: Enable 34 | */ 35 | 36 | #define JD_FASTDECODE 01 37 | /* Optimization level 38 | / 0: Basic optimization. Suitable for 8/16-bit MCUs. 39 | / 1: + 32-bit barrel shifter. Suitable for 32-bit MCUs. 40 | / 2: + Table conversion for huffman decoding (wants 6 << HUFF_BIT bytes of RAM) 41 | */ 42 | 43 | -------------------------------------------------------------------------------- /src/extra/md4c/entity.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MD4C: Markdown parser for C 3 | * (http://github.com/mity/md4c) 4 | * 5 | * Copyright (c) 2016-2024 Martin Mitáš 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | * and/or sell copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 23 | * IN THE SOFTWARE. 24 | */ 25 | 26 | #ifndef MD4C_ENTITY_H 27 | #define MD4C_ENTITY_H 28 | 29 | #include 30 | #include "../../gt_conf.h" 31 | 32 | #if GT_USE_MD4C 33 | 34 | 35 | /* Most entities are formed by single Unicode codepoint, few by two codepoints. 36 | * Single-codepoint entities have codepoints[1] set to zero. */ 37 | typedef struct ENTITY_tag ENTITY; 38 | struct ENTITY_tag { 39 | const char* name; 40 | unsigned codepoints[2]; 41 | }; 42 | 43 | const ENTITY* entity_lookup(const char* name, size_t name_size); 44 | 45 | 46 | #endif /* GT_USE_MD4C */ 47 | #endif /* MD4C_ENTITY_H */ 48 | -------------------------------------------------------------------------------- /src/extra/md4c/gt_md4c.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/extra/md4c/*.c)) 2 | 3 | DEPPATH += --dep-path $(HMI_DIR)/src/extra/md4c 4 | VPATH += :$(HMI_DIR)/src/extra/md4c 5 | 6 | CFLAGS += "-I$(HMI_DIR)/src/extra/md4c" 7 | -------------------------------------------------------------------------------- /src/extra/md4c/md4c-html.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MD4C: Markdown parser for C 3 | * (http://github.com/mity/md4c) 4 | * 5 | * Copyright (c) 2016-2024 Martin Mitáš 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | * and/or sell copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 23 | * IN THE SOFTWARE. 24 | */ 25 | 26 | #ifndef MD4C_HTML_H 27 | #define MD4C_HTML_H 28 | 29 | #include "md4c.h" 30 | 31 | #if GT_USE_MD4C 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | 38 | /* If set, debug output from md_parse() is sent to stderr. */ 39 | #define MD_HTML_FLAG_DEBUG 0x0001 40 | #define MD_HTML_FLAG_VERBATIM_ENTITIES 0x0002 41 | #define MD_HTML_FLAG_SKIP_UTF8_BOM 0x0004 42 | #define MD_HTML_FLAG_XHTML 0x0008 43 | 44 | 45 | /* Render Markdown into HTML. 46 | * 47 | * Note only contents of tag is generated. Caller must generate 48 | * HTML header/footer manually before/after calling md_html(). 49 | * 50 | * Params input and input_size specify the Markdown input. 51 | * Callback process_output() gets called with chunks of HTML output. 52 | * (Typical implementation may just output the bytes to a file or append to 53 | * some buffer). 54 | * Param userdata is just propagated back to process_output() callback. 55 | * Param parser_flags are flags from md4c.h propagated to md_parse(). 56 | * Param render_flags is bitmask of MD_HTML_FLAG_xxxx. 57 | * 58 | * Returns -1 on error (if md_parse() fails.) 59 | * Returns 0 on success. 60 | */ 61 | int md_html(const MD_CHAR* input, MD_SIZE input_size, 62 | void (*process_output)(const MD_CHAR*, MD_SIZE, void*), 63 | void* userdata, unsigned parser_flags, unsigned renderer_flags); 64 | 65 | 66 | #ifdef __cplusplus 67 | } /* extern "C" { */ 68 | #endif 69 | 70 | #endif /** GT_USE_MD4C */ 71 | #endif /* MD4C_HTML_H */ 72 | -------------------------------------------------------------------------------- /src/extra/png/gt_png.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_png.h 3 | * @author Feyoung 4 | * @brief png implementation 5 | * @version 0.1 6 | * @date 2022-08-10 15:48:21 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_PNG_H_ 10 | #define _GT_PNG_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../../gt_conf.h" 18 | 19 | #if GT_USE_PNG 20 | 21 | /* define ---------------------------------------------------------------*/ 22 | #define LODEPNG_NO_COMPILE_ENCODER 23 | // #define LODEPNG_NO_COMPILE_ERROR_TEXT 24 | 25 | /* typedef --------------------------------------------------------------*/ 26 | 27 | 28 | 29 | /* macros ---------------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* class ----------------------------------------------------------------*/ 34 | 35 | 36 | 37 | /* global functions / API interface -------------------------------------*/ 38 | 39 | /** 40 | * @brief PNG image decoder init, register to list. 41 | */ 42 | void gt_png_init(void); 43 | 44 | 45 | #endif /* GT_USE_PNG */ 46 | 47 | #ifdef __cplusplus 48 | } /*extern "C"*/ 49 | #endif 50 | 51 | #endif //!_GT_PNG_H_ 52 | -------------------------------------------------------------------------------- /src/extra/png/gt_png.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/extra/png/*.c)) 2 | 3 | 4 | DEPPATH += --dep-path $(HMI_DIR)/src/extra/png 5 | VPATH += :$(HMI_DIR)/src/extra/png 6 | 7 | CFLAGS += "-I$(HMI_DIR)/src/extra/png" 8 | 9 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/extra/serial/*.c)) 2 | 3 | DEPPATH += --dep-path $(HMI_DIR)/src/extra/serial 4 | VPATH += :$(HMI_DIR)/src/extra/serial 5 | 6 | CFLAGS += "-I$(HMI_DIR)/src/extra/serial" 7 | 8 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_area_light.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_area_light.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-10-18 16:30:47 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_AREA_LIGHT_H_ 10 | #define _GT_SERIAL_AREA_LIGHT_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* typedef --------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* class ----------------------------------------------------------------*/ 35 | 36 | 37 | 38 | /* global functions / API interface -------------------------------------*/ 39 | gt_res_t gt_serial_area_light_create(gt_var_st * var); 40 | gt_res_t gt_serial_area_light_set_value(gt_var_st * var, gt_var_value_st * value); 41 | 42 | 43 | #endif /** GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 44 | 45 | #ifdef __cplusplus 46 | } /*extern "C"*/ 47 | #endif 48 | 49 | #endif //!_GT_SERIAL_AREA_LIGHT_H_ 50 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_command.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_command.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-09-26 16:03:09 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "./gt_serial_command.h" 12 | 13 | #if GT_USE_SERIAL && GT_SERIAL_USE_TIMER_RECV_UNPACK 14 | #include "../../others/gt_log.h" 15 | #include "./gt_serial_show.h" 16 | 17 | 18 | /* private define -------------------------------------------------------*/ 19 | 20 | 21 | 22 | /* private typedef ------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* static variables -----------------------------------------------------*/ 27 | 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* class ----------------------------------------------------------------*/ 35 | 36 | 37 | 38 | /* static functions -----------------------------------------------------*/ 39 | 40 | static gt_res_t _command_decode_handler_cb(uint8_t const * const buffer, uint16_t len) { 41 | gt_serial_pack_buffer_st pack = gt_serial_get_temp_pack_buffer(); 42 | uint8_t cmd_val = buffer[0]; 43 | 44 | if (GT_SERIAL_COMMAND_READ_CMD == cmd_val) { 45 | pack.buffer[0] = GT_SERIAL_COMMAND_PASS_BACK_CMD; 46 | pack.len = 1; 47 | pack.len += gt_serial_get_value(&pack.buffer[1], (uint8_t * )&buffer[1], len - 1); 48 | if (pack.len < 2) { 49 | return GT_RES_INV; 50 | } 51 | return gt_serial_master_send_packet(pack.buffer, pack.len); 52 | } 53 | if (GT_SERIAL_COMMAND_WRITE_CMD == cmd_val) { 54 | gt_serial_set_value((uint8_t * )&buffer[1], len - 1); 55 | } 56 | return GT_RES_OK; 57 | } 58 | 59 | 60 | /* global functions / API interface -------------------------------------*/ 61 | void gt_serial_command_init(void) 62 | { 63 | gt_serial_set_handler_cb(_command_decode_handler_cb); 64 | } 65 | 66 | 67 | /* end ------------------------------------------------------------------*/ 68 | #endif /** GT_USE_SERIAL */ 69 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_command.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_command.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-09-26 16:03:02 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_COMMAND_H_ 10 | #define _GT_SERIAL_COMMAND_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../utils/gt_serial.h" 18 | 19 | #if GT_USE_SERIAL && GT_SERIAL_USE_TIMER_RECV_UNPACK 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | #ifndef GT_SERIAL_COMMAND_WRITE_CMD 24 | /* serial command write cmd */ 25 | #define GT_SERIAL_COMMAND_WRITE_CMD 0x82 26 | #endif 27 | 28 | #ifndef GT_SERIAL_COMMAND_READ_CMD 29 | /* serial command read cmd */ 30 | #define GT_SERIAL_COMMAND_READ_CMD 0x83 31 | #endif 32 | 33 | #ifndef GT_SERIAL_COMMAND_PASS_BACK_CMD 34 | /* serial command pass back cmd */ 35 | #define GT_SERIAL_COMMAND_PASS_BACK_CMD 0x83 36 | #endif 37 | 38 | /* typedef --------------------------------------------------------------*/ 39 | 40 | 41 | 42 | /* macros ---------------------------------------------------------------*/ 43 | 44 | 45 | 46 | /* class ----------------------------------------------------------------*/ 47 | 48 | 49 | 50 | /* global functions / API interface -------------------------------------*/ 51 | /** 52 | * @brief serial command decode 53 | */ 54 | void gt_serial_command_init(void); 55 | 56 | 57 | #endif /** GT_USE_SERIAL */ 58 | 59 | #ifdef __cplusplus 60 | } /*extern "C"*/ 61 | #endif 62 | 63 | #endif //!_GT_SERIAL_COMMAND_H_ 64 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_event.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_event.h 3 | * @author Feyoung 4 | * @brief Add serial event by set callback function template 5 | * @version 0.1 6 | * @date 2024-10-29 17:50:26 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_EVENT_H_ 10 | #define _GT_SERIAL_EVENT_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../../utils/gt_serial.h" 18 | 19 | #if GT_USE_SERIAL && GT_USE_BIN_CONVERT 20 | #include "../../others/gt_types.h" 21 | #include "../../widgets/gt_obj.h" 22 | 23 | 24 | 25 | /* define ---------------------------------------------------------------*/ 26 | 27 | 28 | 29 | /* typedef --------------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* macros ---------------------------------------------------------------*/ 34 | 35 | 36 | 37 | /* class ----------------------------------------------------------------*/ 38 | 39 | 40 | 41 | /* global functions / API interface -------------------------------------*/ 42 | 43 | /** 44 | * @brief Get event header data by address, default header data: 45 | * [0x13, 0x48, 0x4d, 0x49, 0x5f, 0x45, 0x56, page_count_h, page_count_l, event_data_len, 0x00] 46 | * pages: 47 | * 0. [event_count, addr_h, addr_m, addr_l] 48 | * ... 49 | * n. [event_count, addr_h, addr_m, addr_l], n = page_count - 1. 50 | */ 51 | void gt_serial_event_init(void); 52 | 53 | /** 54 | * @brief Dynamically adds a callback function event template to a 55 | * control. When releasing a control, the global variable is released 56 | * 57 | * @param page_index 58 | * @param parent 59 | * @return gt_res_t 60 | */ 61 | gt_res_t gt_serial_event_init_by_page(uint16_t page_index, gt_obj_st * parent); 62 | 63 | #endif /** GT_USE_SERIAL && GT_USE_BIN_CONVERT */ 64 | 65 | #ifdef __cplusplus 66 | } /*extern "C"*/ 67 | #endif 68 | 69 | #endif //!_GT_SERIAL_EVENT_H_ 70 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_qrcode.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_qrcode.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-10-21 16:37:20 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_QRCODE_H_ 10 | #define _GT_SERIAL_QRCODE_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* typedef --------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* class ----------------------------------------------------------------*/ 36 | 37 | 38 | 39 | /* global functions / API interface -------------------------------------*/ 40 | gt_res_t gt_serial_qrcode_create(gt_var_st * var); 41 | gt_res_t gt_serial_qrcode_set_value(gt_var_st * var, gt_var_value_st * value); 42 | 43 | 44 | #endif /** GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 45 | 46 | #ifdef __cplusplus 47 | } /*extern "C"*/ 48 | #endif 49 | 50 | #endif //!_GT_SERIAL_QRCODE_H_ 51 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_resource.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_resource.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-11-11 18:03:00 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_RESOURCE_H_ 10 | #define _GT_SERIAL_RESOURCE_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../../gt_conf.h" 18 | #include "../../others/gt_types.h" 19 | 20 | #if GT_USE_SERIAL && GT_USE_BIN_CONVERT 21 | 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | #define GT_SERIAL_RESOURCE_INVALID_ADDR (0xFFFFFFFF) 25 | 26 | /** 27 | * @brief event resource data offset No.0 file begin 28 | */ 29 | #define GT_SERIAL_RESOURCE_EVENT_OFFSET (1024) 30 | 31 | /* typedef --------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* macros ---------------------------------------------------------------*/ 36 | 37 | 38 | 39 | /* class ----------------------------------------------------------------*/ 40 | 41 | 42 | 43 | /* global functions / API interface -------------------------------------*/ 44 | 45 | /** 46 | * @brief Analysis the serial resource file header data 47 | * 48 | * @return gt_res_t 49 | */ 50 | gt_res_t gt_serial_resource_init(void); 51 | 52 | /** 53 | * @brief Get the address of the resource by the file id 54 | * 55 | * @param file_id 56 | * @return uint32_t 0xFFFFFFFF(GT_SERIAL_RESOURCE_INVALID_ADDR): failed; other: success 57 | */ 58 | uint32_t gt_serial_resource_get_addr_by(uint8_t file_id); 59 | 60 | 61 | #endif /** GT_USE_SERIAL */ 62 | 63 | #ifdef __cplusplus 64 | } /*extern "C"*/ 65 | #endif 66 | 67 | #endif //!_GT_SERIAL_RESOURCE_H_ 68 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_value_passing.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_value_passing.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-10-15 16:44:12 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VALUE_PASSING_H_ 10 | #define _GT_SERIAL_VALUE_PASSING_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | #include "gt_serial_var.h" 22 | 23 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 24 | 25 | 26 | 27 | /* typedef --------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* class ----------------------------------------------------------------*/ 36 | 37 | 38 | 39 | /* global functions / API interface -------------------------------------*/ 40 | gt_res_t gt_serial_value_passing_create(gt_var_st* var); 41 | gt_res_t gt_serial_value_passing_set_value(gt_var_st* var, gt_var_value_st* value); 42 | 43 | 44 | #endif /** GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 45 | 46 | #ifdef __cplusplus 47 | } /*extern "C"*/ 48 | #endif 49 | 50 | #endif //!_GT_SERIAL_VALUE_PASSING_H_ 51 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_anim_icon.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_anim_icon.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-09-26 11:07:44 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_ANIM_ICON_H_ 10 | #define _GT_SERIAL_VAR_ANIM_ICON_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* typedef --------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* global functions / API interface -------------------------------------*/ 35 | gt_res_t gt_serial_var_anim_icon_create(gt_var_st* var); 36 | gt_res_t gt_serial_var_anim_icon_set_value(gt_var_st* var, gt_var_value_st* value); 37 | 38 | 39 | #endif /* GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 40 | // 41 | #ifdef __cplusplus 42 | } /*extern "C"*/ 43 | #endif 44 | 45 | #endif //!_GT_SERIAL_VAR_ANIM_ICON_H_ 46 | 47 | /* end of file ----------------------------------------------------------*/ 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_artistic.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_artistic.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-09-30 15:51:41 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_ARTISTIC_H_ 10 | #define _GT_SERIAL_VAR_ARTISTIC_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* typedef --------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* global functions / API interface -------------------------------------*/ 35 | gt_res_t gt_serial_var_artistic_create(gt_var_st* var); 36 | gt_res_t gt_serial_var_artistic_set_value(gt_var_st* var, gt_var_value_st* value); 37 | 38 | 39 | 40 | #endif /* GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 41 | 42 | 43 | #ifdef __cplusplus 44 | } /*extern "C"*/ 45 | #endif 46 | 47 | #endif //!_GT_SERIAL_VAR_ARTISTIC_H_ 48 | 49 | /* end of file ----------------------------------------------------------*/ 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_bit.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_bit.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-10-11 17:04:56 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_BIT_H_ 10 | #define _GT_SERIAL_VAR_BIT_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* typedef --------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* global functions / API interface -------------------------------------*/ 36 | gt_res_t gt_serial_var_bit_create(gt_var_st* var); 37 | gt_res_t gt_serial_var_bit_set_value(gt_var_st* var, gt_var_value_st* value); 38 | 39 | 40 | #endif /* GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 41 | // 42 | #ifdef __cplusplus 43 | } /*extern "C"*/ 44 | #endif 45 | 46 | #endif //!_GT_SERIAL_VAR_BIT_H_ 47 | 48 | /* end of file ----------------------------------------------------------*/ 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_hex.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_hex.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-10-23 16:42:30 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_HEX_H_ 10 | #define _GT_SERIAL_VAR_HEX_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* typedef --------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* global functions / API interface -------------------------------------*/ 35 | gt_res_t gt_serial_var_hex_create(gt_var_st* var); 36 | gt_res_t gt_serial_var_hex_set_value(gt_var_st* var, gt_var_value_st* value); 37 | 38 | #endif /* GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 39 | // 40 | #ifdef __cplusplus 41 | } /*extern "C"*/ 42 | #endif 43 | 44 | #endif //!_GT_SERIAL_VAR_HEX_H_ 45 | 46 | /* end of file ----------------------------------------------------------*/ 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_icon.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_icon.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-09-24 15:00:58 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_ICON_H_ 10 | #define _GT_SERIAL_VAR_ICON_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | /* define ---------------------------------------------------------------*/ 22 | 23 | 24 | 25 | /* typedef --------------------------------------------------------------*/ 26 | 27 | 28 | 29 | /* macros ---------------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* global functions / API interface -------------------------------------*/ 34 | gt_res_t gt_serial_var_icon_create(gt_var_st* var); 35 | gt_res_t gt_serial_var_icon_set_value(gt_var_st* var, gt_var_value_st* value); 36 | 37 | #endif /* GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 38 | // 39 | #ifdef __cplusplus 40 | } /*extern "C"*/ 41 | #endif 42 | 43 | #endif //!_GT_SERIAL_VAR_ICON_H_ 44 | 45 | /* end of file ----------------------------------------------------------*/ 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_input.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_input.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-11-12 15:44:19 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_INPUT_H_ 10 | #define _GT_SERIAL_VAR_INPUT_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* typedef --------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* global functions / API interface -------------------------------------*/ 35 | gt_res_t gt_serial_var_input_create(gt_var_st * var); 36 | gt_res_t gt_serial_var_input_set_value(gt_var_st * var, gt_var_value_st * value); 37 | 38 | 39 | #endif /** GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 40 | // 41 | #ifdef __cplusplus 42 | } /*extern "C"*/ 43 | #endif 44 | 45 | #endif //!_GT_SERIAL_VAR_INPUT_H_ 46 | 47 | /* end of file ----------------------------------------------------------*/ 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_keypad.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_keypad.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-11-12 16:30:02 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_KEYPAD_H_ 10 | #define _GT_SERIAL_VAR_KEYPAD_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* typedef --------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* global functions / API interface -------------------------------------*/ 35 | gt_res_t gt_serial_var_keypad_create(gt_var_st * var); 36 | gt_res_t gt_serial_var_keypad_set_value(gt_var_st * var, gt_var_value_st * value); 37 | 38 | 39 | #endif /** GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 40 | // 41 | #ifdef __cplusplus 42 | } /*extern "C"*/ 43 | #endif 44 | 45 | #endif //!_GT_SERIAL_VAR_KEYPAD_H_ 46 | 47 | /* end of file ----------------------------------------------------------*/ 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_numb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_numb.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-10-18 15:42:54 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_NUMB_H_ 10 | #define _GT_SERIAL_VAR_NUMB_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* typedef --------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* global functions / API interface -------------------------------------*/ 36 | gt_res_t gt_serial_var_numb_create(gt_var_st* var); 37 | gt_res_t gt_serial_var_numb_set_value(gt_var_st* var, gt_var_value_st* value); 38 | 39 | #endif /* GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 40 | // 41 | #ifdef __cplusplus 42 | } /*extern "C"*/ 43 | #endif 44 | 45 | #endif //!_GT_SERIAL_VAR_NUMB_H_ 46 | 47 | /* end of file ----------------------------------------------------------*/ 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_pic.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_pic.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-10-11 15:24:00 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_PIC_H_ 10 | #define _GT_SERIAL_VAR_PIC_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* typedef --------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* global functions / API interface -------------------------------------*/ 35 | gt_res_t gt_serial_var_pic_create(gt_var_st* var); 36 | gt_res_t gt_serial_var_pic_set_value(gt_var_st* var, gt_var_value_st* value); 37 | 38 | #endif /* GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 39 | // 40 | #ifdef __cplusplus 41 | } /*extern "C"*/ 42 | #endif 43 | 44 | #endif //!_GT_SERIAL_VAR_PIC_H_ 45 | 46 | /* end of file ----------------------------------------------------------*/ 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_progress_bar.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_progress_bar.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-10-29 10:43:41 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_PROGRESS_BAR_H_ 10 | #define _GT_SERIAL_VAR_PROGRESS_BAR_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* typedef --------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* global functions / API interface -------------------------------------*/ 35 | gt_res_t gt_serial_var_progress_bar_create(gt_var_st* var); 36 | gt_res_t gt_serial_var_progress_bar_set_value(gt_var_st* var, gt_var_value_st* value); 37 | 38 | #endif /* GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 39 | // 40 | #ifdef __cplusplus 41 | } /*extern "C"*/ 42 | #endif 43 | 44 | #endif //!_GT_SERIAL_VAR_PROGRESS_BAR_H_ 45 | 46 | /* end of file ----------------------------------------------------------*/ 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_roller.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_roller.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-10-24 16:19:33 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_ROLLER_H_ 10 | #define _GT_SERIAL_VAR_ROLLER_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* typedef --------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* global functions / API interface -------------------------------------*/ 35 | gt_res_t gt_serial_var_roller_create(gt_var_st* var); 36 | gt_res_t gt_serial_var_roller_set_value(gt_var_st* var, gt_var_value_st* value); 37 | 38 | #endif /* GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 39 | // 40 | #ifdef __cplusplus 41 | } /*extern "C"*/ 42 | #endif 43 | 44 | #endif //!_GT_SERIAL_VAR_ROLLER_H_ 45 | 46 | /* end of file ----------------------------------------------------------*/ 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_rtc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_rtc.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-10-23 09:47:46 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_RTC_H_ 10 | #define _GT_SERIAL_VAR_RTC_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* typedef --------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* global functions / API interface -------------------------------------*/ 35 | gt_res_t gt_serial_var_rtc_create(gt_var_st* var); 36 | gt_res_t gt_serial_var_rtc_set_value(gt_var_st* var, gt_var_value_st* value); 37 | 38 | #endif /* GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 39 | #ifdef __cplusplus 40 | } /*extern "C"*/ 41 | #endif 42 | 43 | #endif //!_GT_SERIAL_VAR_RTC_H_ 44 | 45 | /* end of file ----------------------------------------------------------*/ 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_slider.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_slider.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-09-30 10:40:50 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_SLIDER_H_ 10 | #define _GT_SERIAL_VAR_SLIDER_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* typedef --------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* global functions / API interface -------------------------------------*/ 36 | gt_res_t gt_serial_var_slider_create(gt_var_st* var); 37 | gt_res_t gt_serial_var_slider_set_value(gt_var_st* var, gt_var_value_st* value); 38 | 39 | 40 | 41 | #endif /* GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 42 | // 43 | #ifdef __cplusplus 44 | } /*extern "C"*/ 45 | #endif 46 | 47 | #endif //!_GT_SERIAL_VAR_SLIDER_H_ 48 | 49 | /* end of file ----------------------------------------------------------*/ 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/extra/serial/gt_serial_var_text.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_serial_var_text.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-10-21 14:08:05 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SERIAL_VAR_TEXT_H_ 10 | #define _GT_SERIAL_VAR_TEXT_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_serial_var.h" 18 | 19 | #if GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT 20 | 21 | 22 | /* define ---------------------------------------------------------------*/ 23 | 24 | 25 | 26 | /* typedef --------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* macros ---------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* global functions / API interface -------------------------------------*/ 35 | gt_res_t gt_serial_var_text_create(gt_var_st* var); 36 | gt_res_t gt_serial_var_text_set_value(gt_var_st* var, gt_var_value_st* value); 37 | 38 | #endif /* GT_USE_SERIAL_VAR && GT_USE_BIN_CONVERT */ 39 | // 40 | #ifdef __cplusplus 41 | } /*extern "C"*/ 42 | #endif 43 | 44 | #endif //!_GT_SERIAL_VAR_TEXT_H_ 45 | 46 | /* end of file ----------------------------------------------------------*/ 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/font/gt_font.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/font/*.c)) 2 | 3 | DEPPATH += --dep-path $(HMI_DIR)/src/font 4 | VPATH += :$(HMI_DIR)/src/font 5 | 6 | CFLAGS += "-I$(HMI_DIR)/src/font" 7 | -------------------------------------------------------------------------------- /src/gt_api_mapper.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_api_mapper.h 3 | * @author Feyoung 4 | * @brief Remapping of deprecated interfaces 5 | * @version 0.1 6 | * @date 2024-07-19 10:01:14 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_API_MAPPER_H_ 10 | #define _GT_API_MAPPER_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* typedef --------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* class ----------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* global functions / API interface -------------------------------------*/ 37 | 38 | 39 | 40 | #ifdef __cplusplus 41 | } /*extern "C"*/ 42 | #endif 43 | 44 | #endif //!_GT_API_MAPPER_H_ 45 | -------------------------------------------------------------------------------- /src/hal/gt_hal.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/hal/*.c)) 2 | 3 | DEPPATH += --dep-path $(HMI_DIR)/src/hal 4 | VPATH += :$(HMI_DIR)/src/hal 5 | 6 | CFLAGS += "-I$(HMI_DIR)/src/hal" 7 | -------------------------------------------------------------------------------- /src/hal/gt_hal_fs.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_hal_fs.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-08-30 20:29:41 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "./gt_hal_fs.h" 12 | #include "../core/gt_mem.h" 13 | #include "../others/gt_log.h" 14 | 15 | 16 | /* private define -------------------------------------------------------*/ 17 | 18 | 19 | 20 | /* private typedef ------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* static variables -----------------------------------------------------*/ 25 | 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* class ----------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* static functions -----------------------------------------------------*/ 37 | 38 | 39 | 40 | /* global functions / API interface -------------------------------------*/ 41 | 42 | gt_fs_fp_st * _gt_hal_fp_init(void) 43 | { 44 | gt_fs_fp_st * fp = gt_mem_malloc(sizeof(gt_fs_fp_st)); 45 | if (!fp) { 46 | GT_LOGE(GT_LOG_TAG_GUI, "malloc fp fail"); 47 | return fp; 48 | } 49 | gt_memset_0(fp, sizeof(gt_fs_fp_st)); 50 | return fp; 51 | } 52 | 53 | #if GT_USE_DIRECT_ADDR 54 | void gt_hal_direct_addr_init(gt_addr_t * info) 55 | { 56 | *info = GT_ADDR_INVALID; 57 | } 58 | 59 | bool gt_hal_is_invalid_addr(gt_addr_t addr) 60 | { 61 | return addr == GT_ADDR_INVALID; 62 | } 63 | #endif /** GT_USE_DIRECT_ADDR */ 64 | 65 | #if GT_USE_DIRECT_ADDR_CUSTOM_SIZE 66 | void gt_hal_custom_size_addr_init(gt_direct_addr_custom_size_st * custom_addr) 67 | { 68 | if (NULL == custom_addr) { 69 | return ; 70 | } 71 | custom_addr->addr = GT_ADDR_INVALID; 72 | custom_addr->w = 0; 73 | custom_addr->h = 0; 74 | custom_addr->is_alpha = 0; 75 | } 76 | 77 | bool gt_hal_is_invalid_custom_size_addr(gt_direct_addr_custom_size_st * custom_addr) 78 | { 79 | return custom_addr->addr == GT_ADDR_INVALID; 80 | } 81 | #endif /** GT_USE_DIRECT_ADDR_CUSTOM_SIZE */ 82 | 83 | /* end ------------------------------------------------------------------*/ 84 | -------------------------------------------------------------------------------- /src/hal/gt_hal_src.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_hal_src.h 3 | * @author Feyoung 4 | * @brief Hal layer source file system implementation, arrays form management. 5 | * @version 0.1 6 | * @date 2022-08-19 15:25:28 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_HAL_SRC_H_ 10 | #define _GT_HAL_SRC_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../gt_conf.h" 18 | #include "../others/gt_types.h" 19 | #include "./gt_hal_fs.h" 20 | 21 | 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* typedef --------------------------------------------------------------*/ 28 | 29 | /** 30 | * @brief material management 31 | */ 32 | typedef struct gt_src_s { 33 | char * name; ///< path or name 34 | gt_size_t w; ///< width 35 | gt_size_t h; ///< height 36 | uint8_t const * const img; ///< The pointer of image data 37 | uint32_t size; ///< image data count of byte. 38 | uint8_t is_alpha; ///< is not alpha channel 39 | }gt_src_st; 40 | 41 | 42 | /* macros ---------------------------------------------------------------*/ 43 | 44 | 45 | 46 | /* class ----------------------------------------------------------------*/ 47 | 48 | 49 | 50 | /* global functions / API interface -------------------------------------*/ 51 | 52 | /** 53 | * @brief The resource is initialized to the working mode of an array 54 | * 55 | * @param src_sys Resource File System Management 56 | * @param sys_count The length of the sys array. 57 | */ 58 | void gt_src_init(const gt_src_st * const src_sys, uint32_t sys_count); 59 | 60 | #if GT_USE_MODE_SRC 61 | /** 62 | * @brief Get the driver from the resource mode. 63 | * 64 | * @return gt_fs_drv_st* The driver 65 | */ 66 | gt_fs_drv_st * gt_src_get_drv(void); 67 | 68 | #endif /** GT_USE_MODE_SRC */ 69 | 70 | #ifdef __cplusplus 71 | } /*extern "C"*/ 72 | #endif 73 | 74 | #endif //!_GT_HAL_SRC_H_ 75 | -------------------------------------------------------------------------------- /src/hal/gt_hal_tick.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_hal_tick.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-05-19 17:26:34 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "gt_hal_tick.h" 12 | #include "stdint.h" 13 | 14 | /* private define -------------------------------------------------------*/ 15 | 16 | 17 | 18 | /* private typedef ------------------------------------------------------*/ 19 | 20 | 21 | 22 | /* static variables -----------------------------------------------------*/ 23 | static uint32_t _tick = 0; 24 | static volatile uint8_t tick_irq_flag; 25 | 26 | /* macros ---------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* static functions -----------------------------------------------------*/ 31 | 32 | 33 | 34 | /* global functions / API interface -------------------------------------*/ 35 | void gt_tick_inc(uint32_t ms) 36 | { 37 | tick_irq_flag = 0; 38 | _tick += ms; 39 | } 40 | 41 | uint32_t gt_tick_get(void) 42 | { 43 | uint32_t ret = 0; 44 | 45 | do { 46 | tick_irq_flag = 1; 47 | ret = _tick; 48 | } while(!tick_irq_flag); 49 | 50 | return ret; 51 | } 52 | 53 | uint32_t gt_tick_elapse(uint32_t prev_tick) 54 | { 55 | uint32_t tick = gt_tick_get(); 56 | 57 | if (tick >= prev_tick) { 58 | return tick - prev_tick; 59 | } 60 | 61 | //overflow uint32_t 62 | prev_tick = UINT32_MAX - prev_tick + 1; 63 | return prev_tick + tick; 64 | } 65 | 66 | /* end ------------------------------------------------------------------*/ 67 | -------------------------------------------------------------------------------- /src/hal/gt_hal_tick.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_hal_tick.h 3 | * @author Feyoung 4 | * @brief Provide access to the system tick with 1 millisecond resolution 5 | * @version 0.1 6 | * @date 2022-05-19 17:26:21 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_HAL_TICK_H_ 10 | #define _GT_HAL_TICK_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "stdint.h" 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* typedef --------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* global functions / API interface -------------------------------------*/ 33 | /** 34 | * @brief You have to call this function periodically 35 | * 36 | * @param ms the call period of this function in milliseconds 37 | */ 38 | void gt_tick_inc(uint32_t ms); 39 | 40 | /** 41 | * @brief Get the elapsed milliseconds since start up 42 | * 43 | * @return uint32_t the elapsed milliseconds 44 | */ 45 | uint32_t gt_tick_get(void); 46 | 47 | /** 48 | * @brief Get the elapsed milliseconds since a previous time stamp 49 | * 50 | * @param prev_tick a previous time stamp 51 | * @return uint32_t the elapsed milliseconds since 'prev_tick' 52 | */ 53 | uint32_t gt_tick_elapse(uint32_t prev_tick); 54 | 55 | #ifdef __cplusplus 56 | } /*extern "C"*/ 57 | #endif 58 | 59 | #endif //!_GT_TICK_H_ 60 | -------------------------------------------------------------------------------- /src/hal/gt_hal_vf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_hal_vf.h 3 | * @author yongg 4 | * @brief flash resource management implementation 5 | * @version 0.1 6 | * @date 2022-06-20 17:58:44 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_HAL_VF_H_ 10 | #define _GT_HAL_VF_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "stdint.h" 18 | #include "../gt_conf.h" 19 | #include "../others/gt_types.h" 20 | #include "gt_hal_fs.h" 21 | 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | #ifndef GT_HAL_FLASH_READ_CMD 25 | /** 26 | * @brief Flash read command 27 | */ 28 | #define GT_HAL_FLASH_READ_CMD 0x03 29 | #endif 30 | 31 | 32 | /* typedef --------------------------------------------------------------*/ 33 | 34 | /** 35 | * @brief virt file system file message 36 | */ 37 | typedef struct _gt_vfs_s { 38 | char * name; ///< path or file name 39 | gt_size_t w; ///< width 40 | gt_size_t h; ///< height 41 | uint32_t addr; ///< address which resource data save 42 | uint32_t size; ///< the resource size 43 | uint8_t is_alpha; ///< is not alpha channel 44 | }gt_vfs_st; 45 | 46 | /* macros ---------------------------------------------------------------*/ 47 | 48 | 49 | 50 | /* global functions / API interface -------------------------------------*/ 51 | #if GT_USE_MODE_FLASH 52 | 53 | /** 54 | * @brief init virt file system 55 | * 56 | * @param vfs gt_vfs_st arr,pic files messages 57 | */ 58 | void gt_vf_init(const gt_vfs_st * vfs); 59 | 60 | /** 61 | * @brief register virt file system drv 62 | * 63 | * @param drv gt_fs_drv_st device, user need only set _gt_vf_rw 64 | */ 65 | void gt_vf_drv_register(rw_cb_t rw_cb); 66 | 67 | /** 68 | * @brief get default virt file system dev 69 | * 70 | * @return gt_vf_st * 71 | */ 72 | gt_fs_drv_st * gt_vf_get_drv(void); 73 | 74 | #endif /** GT_USE_MODE_FLASH */ 75 | 76 | #ifdef __cplusplus 77 | } /*extern "C"*/ 78 | #endif 79 | 80 | #endif //!_GT_VIRT_FILE_H_ 81 | -------------------------------------------------------------------------------- /src/others/gt_area.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_area.h 3 | * @author yongg 4 | * @brief display area interface 5 | * @version 0.1 6 | * @date 2022-08-11 09:34:53 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_AREA_H_ 10 | #define _GT_AREA_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "stdint.h" 18 | #include "stdbool.h" 19 | #include "gt_types.h" 20 | #include "gt_math.h" 21 | 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | #define AREA_X1(area) (area->x) 25 | #define AREA_X2(area) (area->x + area->w) 26 | #define AREA_Y1(area) (area->y) 27 | #define AREA_Y2(area) (area->y + area->h) 28 | #define AREA_W(area) (area->w) 29 | #define AREA_H(area) (area->h) 30 | 31 | 32 | /* typedef --------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* macros ---------------------------------------------------------------*/ 37 | 38 | 39 | 40 | /* global functions / API interface -------------------------------------*/ 41 | 42 | bool gt_area_is_intersect_screen(const gt_area_st * screen, const gt_area_st * area_fore); 43 | 44 | /** 45 | * @brief calc two areas intersect, the result is begin from area_fore offset value. 46 | * such as: 47 | * 1. screen is (0, 0, 800, 480), area_fore is (10, 10, 100, 100), result: (0, 0, 100, 100) 48 | * 2. screen is (0, 0, 800, 480), area_fore is (0, -20, 100, 100), result: (0, 20, 100, 80) 49 | * if two areas not intersect, the result is (0, 0, 0, 0) 50 | * 51 | * @param screen background area 52 | * @param area_fore foreground area 53 | * @param area_res area intersect point and size 54 | * @return true two areas intersect, 55 | * false two areas not intersect 56 | */ 57 | bool gt_area_intersect_screen(const gt_area_st * screen, const gt_area_st * area_fore, gt_area_st * area_res); 58 | 59 | /** 60 | * @brief The intersection of two regions: area1 and area2, 61 | * the result is stored in area_res 62 | * 63 | * @param area1 64 | * @param area2 65 | * @param area_res 66 | * @return true Have intersection 67 | * @return false No intersection 68 | */ 69 | bool gt_area_cover_screen(gt_area_st const * const area1, gt_area_st const * const area2, gt_area_st * area_res); 70 | 71 | /** 72 | * @brief The inclusion relation of two regions 73 | * 74 | * @param a1_p The pointer of area 75 | * @param a2_p The another pointer of area 76 | * @return true 77 | * @return false 78 | */ 79 | bool gt_area_is_on(gt_area_st * a1_p, gt_area_st * a2_p); 80 | void gt_area_join(gt_area_st * res, const gt_area_st * const src, const gt_area_st * const dst); 81 | 82 | bool gt_area_check_legal(gt_area_st * area); 83 | 84 | /** 85 | * @brief Get the rounded area object 86 | * 87 | * @param angle 88 | * @param radius 89 | * @param thickness 90 | * @param res_area 91 | */ 92 | void gt_rounded_area_get(int16_t angle, uint16_t radius, uint8_t thickness, gt_area_st * res_area); 93 | bool gt_area_intersect_get(gt_area_st * res_p, const gt_area_st * a1_p, const gt_area_st * a2_p); 94 | 95 | 96 | #ifdef __cplusplus 97 | } /*extern "C"*/ 98 | #endif 99 | 100 | #endif //!_GT_AREA_H_ 101 | -------------------------------------------------------------------------------- /src/others/gt_assert.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_assert.h 3 | * @author yongg 4 | * @brief code assertion 5 | * @version 0.1 6 | * @date 2022-07-01 10:06:11 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_ASSERT_H_ 10 | #define _GT_ASSERT_H_ 11 | 12 | #include "stdlib.h" 13 | #include "./gt_log.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | /* include --------------------------------------------------------------*/ 20 | 21 | 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | 25 | #ifndef GT_USE_ASSERT_ENABLE 26 | #define GT_USE_ASSERT_ENABLE 01 27 | #endif 28 | 29 | #ifndef GT_USE_ASSERT_MALLOC 30 | #define GT_USE_ASSERT_MALLOC 01 31 | #endif 32 | 33 | #ifdef _GT_PORT_SIMULATOR_ENVS 34 | #define _ASSERT_ABORT() abort() 35 | #else 36 | #define _ASSERT_ABORT() while(1){} 37 | #endif 38 | 39 | #define GT_ASSERT_MSG(expr, msg) do { \ 40 | if (!(expr)) { \ 41 | GT_LOG_A(GT_LOG_TAG_ASSERT, "Failed: %s is %s at %s:%d", #expr, msg, __FILE__, __LINE__); \ 42 | } \ 43 | } while (0) 44 | 45 | 46 | /* check null assert */ 47 | #if GT_USE_ASSERT_ENABLE 48 | #define GT_ASSERT(p) do { \ 49 | if (!p) { \ 50 | GT_LOG_A(GT_LOG_TAG_ASSERT, "Failed: %s is NULL at %s:%d", #p, __FILE__, __LINE__); \ 51 | _ASSERT_ABORT(); \ 52 | } \ 53 | } while(0) 54 | 55 | #define GT_ASSERT_EXPR(expr) do { \ 56 | if (!(expr)) { \ 57 | GT_LOG_A(GT_LOG_TAG_ASSERT, "Failed: %s at %s:%d", #expr, __FILE__, __LINE__); \ 58 | _ASSERT_ABORT(); \ 59 | } \ 60 | } while(0) 61 | #else 62 | #define GT_ASSERT(p) 63 | #define GT_ASSERT_EXPR(expr) 64 | #endif 65 | 66 | #if GT_USE_ASSERT_MALLOC 67 | #define GT_ASSERT_MALLOC(expr) GT_ASSERT_MSG(NULL != expr, "out of memory") 68 | #else 69 | #define GT_ASSERT_MALLOC(expr) 70 | #endif 71 | 72 | /* typedef --------------------------------------------------------------*/ 73 | 74 | 75 | 76 | /* macros ---------------------------------------------------------------*/ 77 | 78 | 79 | 80 | /* global functions / API interface -------------------------------------*/ 81 | 82 | 83 | 84 | #ifdef __cplusplus 85 | } /*extern "C"*/ 86 | #endif 87 | 88 | #endif //!_GT_ASSERT_H_ 89 | -------------------------------------------------------------------------------- /src/others/gt_color.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_color.c 3 | * @author yongg 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-05-13 10:23:58 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "gt_color.h" 12 | #include "../widgets/gt_obj.h" 13 | #include "../core/gt_mem.h" 14 | #include "./gt_log.h" 15 | 16 | /* private define -------------------------------------------------------*/ 17 | 18 | 19 | 20 | /* private typedef ------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* static variables -----------------------------------------------------*/ 25 | static uint32_t _focus_color = GT_FOCUS_COLOR_SELECT; 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* static functions -----------------------------------------------------*/ 33 | 34 | 35 | 36 | /* global functions / API interface -------------------------------------*/ 37 | 38 | void gt_color_fill(gt_color_t * color_arr, uint32_t len, gt_color_t color) 39 | { 40 | gt_color_t * ptr = color_arr; 41 | gt_color_t const * end_p = color_arr + len - 2; 42 | #if 16 == GT_COLOR_DEPTH 43 | uint32_t * ptr32 = NULL; 44 | uint32_t color32 = (color.full << 16) | color.full; 45 | #endif 46 | 47 | if ((gt_uintptr_t)ptr & 0x3) { 48 | *ptr = color; ++ptr; 49 | } 50 | while (ptr < end_p) { 51 | #if 16 == GT_COLOR_DEPTH 52 | ptr32 = (uint32_t *)ptr; 53 | ptr32[0] = color32; 54 | #else 55 | ptr[0] = color; 56 | ptr[1] = color; 57 | #endif 58 | ptr += 2; 59 | } 60 | 61 | end_p = color_arr + len; 62 | while (ptr < end_p) { 63 | *ptr = color; ++ptr; 64 | } 65 | } 66 | 67 | gt_color_t gt_color_focus(void) 68 | { 69 | return gt_color_hex(_focus_color); 70 | } 71 | 72 | void gt_color_focus_set(uint32_t color) 73 | { 74 | _focus_color = color; 75 | } 76 | 77 | /* end ------------------------------------------------------------------*/ 78 | -------------------------------------------------------------------------------- /src/others/gt_defs.h: -------------------------------------------------------------------------------- 1 | /* libc/sys/linux/sys/cdefs.h - Helper macros for K&R vs. ANSI C compat. */ 2 | 3 | /* Written 2000 by Werner Almesberger */ 4 | 5 | /*- 6 | * Copyright (c) 1991, 1993 7 | * The Regents of the University of California. All rights reserved. 8 | * 9 | * This code is derived from software contributed to Berkeley by 10 | * Berkeley Software Design, Inc. 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 1. Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 4. Neither the name of the University nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 | * SUCH DAMAGE. 35 | * 36 | * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 37 | * $FreeBSD$ 38 | */ 39 | 40 | #ifndef _SYS_DEFS_H_ 41 | #define _SYS_DEFS_H_ 42 | 43 | // #include "types.h" 44 | // #include "compiler.h" 45 | 46 | #ifndef __DEQUALIFY 47 | #define __DEQUALIFY(type, var) ((type)(uintptr_t)(const volatile void *)(var)) 48 | #endif 49 | 50 | #ifndef offsetof 51 | #define offsetof(type, field) \ 52 | ((size_t)(uintptr_t)((const volatile void *)&((type *)0)->field)) 53 | #endif 54 | 55 | #ifndef __offsetof 56 | #define __offsetof(type, field) offsetof(type, field) 57 | #endif 58 | 59 | #ifndef __containerof 60 | #define __containerof(ptr, type, field) \ 61 | __DEQUALIFY(type *, (const volatile char *)(ptr) - offsetof(type, field)) 62 | #endif 63 | 64 | #ifndef container_of 65 | #define container_of(ptr, type, field) __containerof(ptr, type, field) 66 | #endif 67 | 68 | 69 | /* 70 | * Definitions for byte order, according to byte significance from low 71 | * address to high. 72 | */ 73 | #ifndef _LITTLE_ENDIAN 74 | #define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ 75 | #endif 76 | #ifndef _BIG_ENDIAN 77 | #define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ 78 | #endif 79 | 80 | #ifndef LITTLE_ENDIAN 81 | #define LITTLE_ENDIAN _LITTLE_ENDIAN 82 | #endif 83 | #ifndef BIG_ENDIAN 84 | #define BIG_ENDIAN _BIG_ENDIAN 85 | #endif 86 | 87 | #ifndef _BYTE_ORDER 88 | #define _BYTE_ORDER _LITTLE_ENDIAN 89 | #endif 90 | #ifndef BYTE_ORDER 91 | #define BYTE_ORDER _BYTE_ORDER 92 | #endif 93 | 94 | #endif /* _SYS_DEFS_H_ */ 95 | -------------------------------------------------------------------------------- /src/others/gt_gc.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_gc.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-06-14 16:56:38 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "gt_gc.h" 12 | #include "stdlib.h" 13 | 14 | 15 | /* private define -------------------------------------------------------*/ 16 | 17 | 18 | 19 | /* private typedef ------------------------------------------------------*/ 20 | 21 | GT_ATTRIBUTE_RAM_DATA gt_gc_st _gt_global_call = { 22 | .scr_info = { 23 | .home_scr = { 24 | .id = -1, 25 | .screen = NULL, 26 | .alive = false, 27 | } 28 | }, 29 | ._gt_event_node_header_ll = NULL, 30 | #if GT_USE_EXTRA_FULL_IMG_BUFFER 31 | .full_img_buffer = { 32 | .buffer = NULL, 33 | .len = 0, 34 | #if GT_USE_EXTRA_FULL_IMG_OFFSET 35 | .offset = 0, 36 | #endif 37 | }, 38 | #endif 39 | #if GT_USE_FILE_HEADER 40 | .file_header_ctl = { 41 | .header = NULL, 42 | .count = 0, 43 | }, 44 | #endif 45 | #if GT_USE_SCREEN_ANIM 46 | .event_ctl = { 47 | .enabled = true, 48 | }, 49 | #endif 50 | #if GT_FONT_USE_ASCII_WIDTH_CACHE 51 | .ascii_width_cache = { 52 | .option = GT_CFG_DEFAULT_FONT_FAMILY, 53 | }, 54 | #endif 55 | }; 56 | 57 | /* static variables -----------------------------------------------------*/ 58 | 59 | 60 | 61 | /* macros ---------------------------------------------------------------*/ 62 | 63 | 64 | 65 | /* class ----------------------------------------------------------------*/ 66 | 67 | 68 | 69 | /* static functions -----------------------------------------------------*/ 70 | 71 | 72 | 73 | /* global functions / API interface -------------------------------------*/ 74 | 75 | gt_disp_st * _gt_gc_get_disp(void) 76 | { 77 | return _gt_global_call.disp; 78 | } 79 | 80 | void _gt_gc_set_disp(gt_disp_st * disp) 81 | { 82 | _gt_global_call.disp = disp; 83 | } 84 | 85 | _gt_gc_scr_st * _gt_gc_get_scr_info(void) 86 | { 87 | return &_gt_global_call.scr_info; 88 | } 89 | 90 | uint16_t _gt_gc_get_size(void) 91 | { 92 | return sizeof(gt_gc_st); 93 | } 94 | 95 | #if GT_USE_EXTRA_FULL_IMG_BUFFER 96 | void gt_gc_set_full_img_buffer(uint8_t * buffer, uint32_t len) 97 | { 98 | _gt_global_call.full_img_buffer.buffer = buffer; 99 | _gt_global_call.full_img_buffer.len = len; 100 | } 101 | 102 | #if GT_USE_EXTRA_FULL_IMG_OFFSET 103 | void gt_gc_set_full_img_buffer_offset(uint32_t offset) 104 | { 105 | _gt_global_call.full_img_buffer.offset = offset; 106 | } 107 | #endif 108 | 109 | _gt_gc_full_img_buffer_st * _gt_gc_get_full_img_buffer(void) 110 | { 111 | return &_gt_global_call.full_img_buffer; 112 | } 113 | #endif 114 | 115 | #if GT_FONT_USE_ASCII_WIDTH_CACHE 116 | /** 117 | * @brief Get the ASCII font width cache object 118 | * 119 | * @return _gt_gc_ascii_width_cache_st 120 | */ 121 | _gt_gc_ascii_width_cache_st * _gt_gc_get_ascii_width_cache(void) 122 | { 123 | return &_gt_global_call.ascii_width_cache; 124 | } 125 | #endif 126 | /* end ------------------------------------------------------------------*/ 127 | -------------------------------------------------------------------------------- /src/others/gt_ll.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_ll.c 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-06-14 20:58:01 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "gt_ll.h" 12 | #include "gt_types.h" 13 | #include "../core/gt_mem.h" 14 | #include "../core/gt_timer.h" 15 | #include "../others/gt_log.h" 16 | 17 | /* private define -------------------------------------------------------*/ 18 | 19 | 20 | 21 | /* private typedef ------------------------------------------------------*/ 22 | 23 | 24 | 25 | /* static variables -----------------------------------------------------*/ 26 | 27 | 28 | 29 | /* macros ---------------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* class ----------------------------------------------------------------*/ 34 | 35 | 36 | 37 | /* static functions -----------------------------------------------------*/ 38 | 39 | 40 | 41 | /* global functions / API interface -------------------------------------*/ 42 | 43 | 44 | 45 | /* end ------------------------------------------------------------------*/ 46 | -------------------------------------------------------------------------------- /src/others/gt_ll.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_ll.h 3 | * @author Feyoung 4 | * @brief unused 5 | * @version 0.1 6 | * @date 2022-06-14 20:53:51 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_LL_H_ 10 | #define _GT_LL_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_list.h" 18 | #include "stdint.h" 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* typedef --------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* class ----------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* global functions / API interface -------------------------------------*/ 37 | 38 | 39 | 40 | #ifdef __cplusplus 41 | } /*extern "C"*/ 42 | #endif 43 | 44 | #endif //!_GT_LL_H_ 45 | -------------------------------------------------------------------------------- /src/others/gt_others.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/others/*.c)) 2 | 3 | 4 | DEPPATH += --dep-path $(HMI_DIR)/src/others 5 | VPATH += :$(HMI_DIR)/src/others 6 | 7 | CFLAGS += "-I$(HMI_DIR)/src/others" 8 | -------------------------------------------------------------------------------- /src/others/gt_txt.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_txt.c 3 | * @author yongg 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-08-26 14:55:59 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | 10 | /* include --------------------------------------------------------------*/ 11 | #include "gt_txt.h" 12 | #include "../core/gt_mem.h" 13 | #include "../font/gt_font.h" 14 | #include "gt_log.h" 15 | /* private define -------------------------------------------------------*/ 16 | 17 | 18 | 19 | /* private typedef ------------------------------------------------------*/ 20 | 21 | 22 | 23 | /* static variables -----------------------------------------------------*/ 24 | 25 | 26 | 27 | /* macros ---------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* static functions -----------------------------------------------------*/ 32 | 33 | 34 | static char gt_txt_string_del(char * str, uint8_t encoding, uint32_t del_txt_pos) { 35 | uint32_t len = 0, len_str = str ? strlen(str) : 0; 36 | int32_t idx = del_txt_pos; 37 | 38 | len = gt_txt_check_char_numb(str, encoding, &idx); 39 | 40 | if(!len){ 41 | return 0 ; 42 | } 43 | 44 | if(len_str > del_txt_pos){ 45 | gt_memcpy( &str[idx] , &str[idx+len], len_str - (idx+len) ) ; 46 | } 47 | gt_memset(&str[len_str - len], 0, len); 48 | len_str = strlen(str); 49 | str = (char * )gt_mem_realloc(str, len_str + 1); 50 | str[len_str] = '\0'; 51 | 52 | return len; 53 | 54 | } 55 | /* global functions / API interface -------------------------------------*/ 56 | 57 | uint8_t gt_txt_check_char_numb(char * dst, uint8_t encoding, int32_t* pos) 58 | { 59 | uint32_t len = 0; 60 | int32_t *idx = pos; 61 | while ((*idx) >= 0) { 62 | if(GT_ENCODING_UTF8 == encoding) { 63 | len = gt_utf8_check_char((uint8_t * )&dst[*idx]); 64 | } 65 | else if(GT_ENCODING_GB == encoding) { 66 | len = gt_gb_check_char((uint8_t * )dst , *pos , NULL); 67 | *pos -= (len-1); 68 | return len; 69 | } 70 | if(!len) { 71 | --(*idx); 72 | continue; 73 | } 74 | break; 75 | } 76 | 77 | return len; 78 | } 79 | 80 | 81 | /** 82 | * @brief insert src to the pos position in dst 83 | * 84 | * @param dst dst string 85 | * @param pos position 86 | * @param src need insert src string 87 | */ 88 | char * gt_txt_ins(char * dst, uint32_t pos, char * src) 89 | { 90 | if (!dst || !src) { 91 | return dst; 92 | } 93 | uint32_t len_dst = strlen(dst); 94 | uint32_t len_src = strlen(src); 95 | uint32_t len_all = len_dst + len_src; 96 | if (pos > len_dst) { 97 | return dst; 98 | } 99 | dst = (char * )gt_mem_realloc(dst, len_all + 1); 100 | GT_CHECK_BACK_VAL(dst, NULL); 101 | /*move chars*/ 102 | if (len_dst > pos) { 103 | gt_memmove(&dst[pos + len_src], &dst[pos], len_dst - pos); 104 | } 105 | gt_memmove(&dst[pos], src, len_src); 106 | dst[len_all] = '\0'; 107 | 108 | return dst; 109 | } 110 | 111 | /** 112 | * @brief cut out dst string from pos_start to pos_end 113 | * 114 | * @param dst dst string 115 | * @param pos_start position start 116 | * @param pos_end position end 117 | */ 118 | char gt_txt_cut(char * dst, uint8_t encoding, uint32_t pos_start, uint32_t pos_end) 119 | { 120 | uint32_t len_dst = dst ? strlen(dst) : 0; 121 | uint32_t ps = pos_start, pe = pos_end; 122 | 123 | if (!len_dst) { return 0; } 124 | if (pos_start > pos_end) { 125 | pe = pos_start; 126 | ps = pos_end; 127 | } 128 | if (ps > len_dst) { return 0; } 129 | if (pe > len_dst) { pe = len_dst; } 130 | return gt_txt_string_del(dst, encoding, ps); 131 | } 132 | /* end ------------------------------------------------------------------*/ 133 | -------------------------------------------------------------------------------- /src/others/gt_txt.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_txt.h 3 | * @author yongg 4 | * @brief content implementation 5 | * @version 0.1 6 | * @date 2022-08-26 14:56:04 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_TXT_H_ 10 | #define _GT_TXT_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "string.h" 18 | #include "stdint.h" 19 | 20 | 21 | /* define ---------------------------------------------------------------*/ 22 | 23 | 24 | 25 | /* typedef --------------------------------------------------------------*/ 26 | 27 | 28 | 29 | /* macros ---------------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* global functions / API interface -------------------------------------*/ 34 | char * gt_txt_ins(char * dst, uint32_t pos, char * src); 35 | 36 | /** 37 | * @brief 38 | * 39 | * @param dst 40 | * @param encoding @ref gt_encoding_et 41 | * @param pos_start 42 | * @param pos_end 43 | * @return char 44 | */ 45 | char gt_txt_cut(char * dst, uint8_t encoding, uint32_t pos_start, uint32_t pos_end); 46 | 47 | /** 48 | * @brief 49 | * 50 | * @param dst 51 | * @param encoding @ref gt_encoding_et 52 | * @param pos 53 | * @return uint8_t 54 | */ 55 | uint8_t gt_txt_check_char_numb(char * dst, uint8_t encoding, int32_t* pos); 56 | 57 | #ifdef __cplusplus 58 | } /*extern "C"*/ 59 | #endif 60 | 61 | #endif //!_GT_TXT_H_ 62 | -------------------------------------------------------------------------------- /src/utils/gt_img_cache.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_img_cache.h 3 | * @author Feyoung 4 | * @brief The image cache function, which can be used to cache the image data. 5 | * @version 0.1 6 | * @date 2024-10-17 10:27:10 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_IMG_CACHE_H_ 10 | #define _GT_IMG_CACHE_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../gt_conf.h" 18 | 19 | #if GT_USE_IMG_CACHE 20 | #include "../others/gt_types.h" 21 | #include "../others/gt_color.h" 22 | #include "../hal/gt_hal_file_header.h" 23 | 24 | /* define ---------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* typedef --------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* macros ---------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* class ----------------------------------------------------------------*/ 37 | 38 | 39 | 40 | /* global functions / API interface -------------------------------------*/ 41 | 42 | /** 43 | * @brief Get the raw meta data from the image cache, which cache buffer is provided by the user; 44 | * The cache buffer size must be enough to store the image data. 45 | * byte_len >= (sizeof(gt_color_t) + sizeof(gt_opa_t)) * width * height; 46 | * 47 | * @param src The path of the image 48 | * @param cache_buffer The cache buffer provided by the user 49 | * @param byte_len The size of the cache buffer 50 | * @return gt_color_img_raw_st using the result to set widget image data, such as: gt_img_set_raw_data(), and so on. 51 | * If the return raw.buffer value is invalid, the image data is not cached. 52 | */ 53 | gt_color_img_raw_st gt_img_cache_get_raw(char * src, uint8_t * cache_buffer, uint32_t byte_len); 54 | 55 | #if GT_USE_FILE_HEADER 56 | /** 57 | * @brief Get the raw meta data from the image cache, which cache buffer is provided by the user; 58 | * The cache buffer size must be enough to store the image data. 59 | * byte_len >= (sizeof(gt_color_t) + sizeof(gt_opa_t)) * width * height; 60 | * 61 | * @param fh Using the file header information to get the image data 62 | * @param cache_buffer The cache buffer provided by the user 63 | * @param byte_len The size of the cache buffer 64 | * @return gt_color_img_raw_st using the result to set widget image data, such as: gt_img_set_raw_data(), and so on. 65 | * If the return raw.buffer value is invalid, the image data is not cached. 66 | */ 67 | gt_color_img_raw_st gt_img_cache_fh_get_raw(gt_file_header_param_st * fh, uint8_t * cache_buffer, uint32_t byte_len); 68 | #endif 69 | 70 | #if GT_USE_DIRECT_ADDR 71 | /** 72 | * @brief Get the raw meta data from the image cache, which cache buffer is provided by the user; 73 | * The cache buffer size must be enough to store the image data. 74 | * byte_len >= (sizeof(gt_color_t) + sizeof(gt_opa_t)) * width * height; 75 | * 76 | * @param addr The address of the image data 77 | * @param cache_buffer The cache buffer provided by the user 78 | * @param byte_len The size of the cache buffer 79 | * @return gt_color_img_raw_st using the result to set widget image data, such as: gt_img_set_raw_data(), and so on. 80 | * If the return raw.buffer value is invalid, the image data is not cached. 81 | */ 82 | gt_color_img_raw_st gt_img_cache_addr_get_raw(gt_addr_t addr, uint8_t * cache_buffer, uint32_t byte_len); 83 | #endif 84 | 85 | 86 | #endif /** GT_USE_IMG_CACHE */ 87 | 88 | #ifdef __cplusplus 89 | } /*extern "C"*/ 90 | #endif 91 | 92 | #endif //!_GT_IMG_CACHE_H_ 93 | -------------------------------------------------------------------------------- /src/utils/gt_utils.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/utils/*.c)) 2 | 3 | 4 | DEPPATH += --dep-path $(HMI_DIR)/src/utils 5 | VPATH += :$(HMI_DIR)/src/utils 6 | 7 | CFLAGS += "-I$(HMI_DIR)/src/utils" 8 | -------------------------------------------------------------------------------- /src/widgets/gt_barcode.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_barcode.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-12-09 13:40:04 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_BARCODE_H_ 10 | #define _GT_BARCODE_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_BARCODE 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | #include "gt_conf_widgets.h" 23 | 24 | 25 | #ifdef GT_CONFIG_GUI_DRIVER_LIB 26 | #include "../../driver/gt_gui_driver.h" 27 | #endif /* GT_CONFIG_GUI_DRIVER_LIB */ 28 | 29 | /* define ---------------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* typedef --------------------------------------------------------------*/ 34 | 35 | 36 | 37 | /* macros ---------------------------------------------------------------*/ 38 | 39 | 40 | 41 | /* global functions / API interface -------------------------------------*/ 42 | /** 43 | * @brief create a barcode obj 44 | * 45 | * @param parent barcode's parent element 46 | * @return gt_obj_st* barcode obj 47 | */ 48 | gt_obj_st * gt_barcode_create(gt_obj_st * parent); 49 | 50 | void gt_barcode_set_code_text(gt_obj_st * barcode , char* code); 51 | /** 52 | * @brief Set bar-code type 53 | * 54 | * @param barcode 55 | * @param family @ref gt_gui_driver.h/barcode_type_te which export by GT-HMI-Designer tool. 56 | */ 57 | void gt_barcode_set_type(gt_obj_st * barcode , gt_family_t family); 58 | void gt_barcode_set_hri_type(gt_obj_st * barcode , gt_family_t family); 59 | void gt_barcode_set_mode_w(gt_obj_st * barcode , uint8_t value); 60 | void gt_barcode_set_mode_h(gt_obj_st * barcode , uint8_t value); 61 | void gt_barcode_set_upc_e_sys_code(gt_obj_st * barcode , uint8_t value); 62 | 63 | 64 | #endif /** GT_CFG_ENABLE_BARCODE */ 65 | 66 | #ifdef __cplusplus 67 | } /*extern "C"*/ 68 | #endif 69 | 70 | #endif //!_GT_BARCODE_H_ 71 | 72 | /* end of file ----------------------------------------------------------*/ 73 | 74 | 75 | -------------------------------------------------------------------------------- /src/widgets/gt_chat.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_chat.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-03-19 14:31:18 7 | * @copyright Copyright (c) 2014-2024, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_CHAT_H_ 10 | #define _GT_CHAT_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_CHAT 20 | #include "./gt_obj.h" 21 | #include "../core/gt_style.h" 22 | #include "../font/gt_font.h" 23 | 24 | 25 | /* define ---------------------------------------------------------------*/ 26 | #define GT_CHAT_MAX_MSG_CNT (20) 27 | 28 | 29 | 30 | /* typedef --------------------------------------------------------------*/ 31 | typedef enum { 32 | GT_CHAT_TYPE_TEXT = 0, 33 | GT_CHAT_TYPE_VOICE, 34 | }gt_chat_type_te; 35 | 36 | 37 | /* macros ---------------------------------------------------------------*/ 38 | 39 | 40 | 41 | /* global functions / API interface -------------------------------------*/ 42 | gt_obj_st * gt_chat_create(gt_obj_st * parent); 43 | 44 | void gt_chat_set_bg_color(gt_obj_st * chat, gt_color_t color); 45 | 46 | void gt_chat_add_send_text_msg(gt_obj_st * chat, const char * msg); 47 | void gt_chat_add_send_voice_msg(gt_obj_st * chat, uint8_t tim_s); 48 | 49 | void gt_chat_add_received_text_msg(gt_obj_st * chat, const char * msg); 50 | void gt_chat_add_received_voice_msg(gt_obj_st * chat, uint8_t tim_s); 51 | 52 | void gt_chat_append_msg_text(gt_obj_st * chat, const char * msg); 53 | 54 | void gt_chat_clean_all_msg(gt_obj_st * chat); 55 | 56 | void gt_chat_set_msg_radius(gt_obj_st * chat, gt_radius_t radius); 57 | 58 | void gt_chat_set_send_msg_bg_color(gt_obj_st * chat, gt_color_t color); 59 | void gt_chat_set_received_msg_bg_color(gt_obj_st * chat, gt_color_t color); 60 | void gt_chat_set_send_msg_border_color(gt_obj_st * chat, gt_color_t color); 61 | void gt_chat_set_received_msg_border_color(gt_obj_st * chat, gt_color_t color); 62 | void gt_chat_set_send_msg_border_width(gt_obj_st * chat, uint8_t width); 63 | void gt_chat_set_received_msg_border_width(gt_obj_st * chat, uint8_t width); 64 | void gt_chat_set_send_msg_font_color(gt_obj_st * chat, gt_color_t color); 65 | void gt_chat_set_received_msg_font_color(gt_obj_st * chat, gt_color_t color); 66 | 67 | void gt_chat_set_font_size(gt_obj_st * chat, uint8_t size); 68 | void gt_chat_set_font_gray(gt_obj_st * chat, uint8_t gray); 69 | #if (defined(GT_FONT_FAMILY_OLD_ENABLE) && (GT_FONT_FAMILY_OLD_ENABLE == 1)) 70 | void gt_chat_set_font_family_cn(gt_obj_st * chat, gt_family_t font_family_cn); 71 | void gt_chat_set_font_family_en(gt_obj_st * chat, gt_family_t font_family_en); 72 | void gt_chat_set_font_family_fl(gt_obj_st * chat, gt_family_t font_family_fl); 73 | void gt_chat_set_font_family_numb(gt_obj_st * chat, gt_family_t font_family_numb); 74 | #else 75 | void gt_chat_set_font_family(gt_obj_st * chat, gt_family_t font_family); 76 | void gt_chat_set_font_cjk(gt_obj_st* chat, gt_font_cjk_et cjk); 77 | #endif 78 | void gt_chat_set_font_thick_en(gt_obj_st * chat, uint8_t thick); 79 | void gt_chat_set_font_thick_cn(gt_obj_st * chat, uint8_t thick); 80 | void gt_chat_set_font_style(gt_obj_st * chat, gt_font_style_et font_style); 81 | 82 | 83 | #ifdef __cplusplus 84 | } /*extern "C"*/ 85 | #endif 86 | 87 | #endif /** GT_CFG_ENABLE_CHATTING */ 88 | 89 | #endif //!_GT_CHAT_H_ 90 | 91 | /* end of file ----------------------------------------------------------*/ 92 | 93 | -------------------------------------------------------------------------------- /src/widgets/gt_checkbox.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_checkbox.h 3 | * @author yongg 4 | * @brief checkbox element 5 | * @version 0.1 6 | * @date 2022-07-18 14:11:44 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_CHECKBOX_H_ 10 | #define _GT_CHECKBOX_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_CHECKBOX 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | #include "stdarg.h" 23 | #include "stdlib.h" 24 | #include "../font/gt_font.h" 25 | 26 | /* define ---------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* typedef --------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* macros ---------------------------------------------------------------*/ 35 | 36 | 37 | 38 | /* global functions / API interface -------------------------------------*/ 39 | 40 | /** 41 | * @brief create checkbox obj 42 | * 43 | * @param parent checkbox's parent obj 44 | * @return gt_obj_st* checkbox obj ptr 45 | */ 46 | gt_obj_st * gt_checkbox_create(gt_obj_st * parent); 47 | 48 | /** 49 | * @brief set the checkbox text 50 | * 51 | * @param checkbox checkbox obj 52 | * @param fmt text format 53 | */ 54 | void gt_checkbox_set_text(gt_obj_st * checkbox, const char * fmt, ...); 55 | 56 | void gt_checkbox_set_text_by_len(gt_obj_st * checkbox, const char * text, uint16_t len); 57 | 58 | char * gt_checkbox_get_text(gt_obj_st * checkbox); 59 | 60 | void gt_checkbox_set_font_color(gt_obj_st * checkbox, gt_color_t color); 61 | #if (defined(GT_FONT_FAMILY_OLD_ENABLE) && (GT_FONT_FAMILY_OLD_ENABLE == 1)) 62 | void gt_checkbox_set_font_family_cn(gt_obj_st * checkbox, gt_family_t family); 63 | void gt_checkbox_set_font_family_en(gt_obj_st * checkbox, gt_family_t family); 64 | void gt_checkbox_set_font_family_fl(gt_obj_st * checkbox, gt_family_t family); 65 | void gt_checkbox_set_font_family_numb(gt_obj_st * checkbox, gt_family_t family); 66 | #else 67 | void gt_checkbox_set_font_family(gt_obj_st * checkbox, gt_family_t family); 68 | void gt_checkbox_set_font_cjk(gt_obj_st* checkbox, gt_font_cjk_et cjk); 69 | #endif 70 | void gt_checkbox_set_font_size(gt_obj_st * checkbox, uint8_t size); 71 | void gt_checkbox_set_font_gray(gt_obj_st * checkbox, uint8_t gray); 72 | void gt_checkbox_set_font_thick_en(gt_obj_st * checkbox, uint8_t thick); 73 | void gt_checkbox_set_font_thick_cn(gt_obj_st * checkbox, uint8_t thick); 74 | void gt_checkbox_set_font_encoding(gt_obj_st * checkbox, gt_encoding_et encoding); 75 | void gt_checkbox_set_font_style(gt_obj_st * checkbox, gt_font_style_et font_style); 76 | void gt_checkbox_set_space(gt_obj_st * checkbox, uint8_t space_x, uint8_t space_y); 77 | 78 | void gt_checkbox_set_font_point_offset_x(gt_obj_st * checkbox , gt_size_t x); 79 | void gt_checkbox_set_font_point_offset_y(gt_obj_st * checkbox , gt_size_t y); 80 | void gt_checkbox_set_font_point_offset(gt_obj_st * checkbox , gt_size_t x , gt_size_t y); 81 | 82 | 83 | 84 | #endif /** GT_CFG_ENABLE_CHECKBOX */ 85 | 86 | #ifdef __cplusplus 87 | } /*extern "C"*/ 88 | #endif 89 | 90 | #endif //!_GT_CHECKBOX_H_ 91 | -------------------------------------------------------------------------------- /src/widgets/gt_conf_widgets.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_conf_widgets.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-05-11 16:18:14 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_CONF_WIDGETS_H_ 10 | #define _GT_CONF_WIDGETS_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../gt_conf.h" 18 | 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | /** 23 | * @brief Configure whether the widgets is enabled 24 | * such as: gt_template.c/h 25 | */ 26 | #define GT_CFG_ENABLE_TEMPLATE 0 27 | 28 | #define GT_CFG_ENABLE_BTN 1 29 | #define GT_CFG_ENABLE_CHECKBOX 1 30 | #define GT_CFG_ENABLE_GROUP 1 31 | #define GT_CFG_ENABLE_IMG 1 32 | #define GT_CFG_ENABLE_INPUT 1 33 | /**the keypad must exist with input widget*/ 34 | #define GT_CFG_ENABLE_KEYPAD 1 35 | #define GT_CFG_ENABLE_LABEL 1 36 | #define GT_CFG_ENABLE_LISTVIEW 1 37 | #define GT_CFG_ENABLE_PROGRESS_BAR 1 38 | #define GT_CFG_ENABLE_RADIO 1 39 | #define GT_CFG_ENABLE_SLIDER 1 40 | #define GT_CFG_ENABLE_SWITCH 1 41 | #define GT_CFG_ENABLE_TEXTAREA 1 42 | #define GT_CFG_ENABLE_IMGBTN 1 43 | #define GT_CFG_ENABLE_RECT 1 44 | #define GT_CFG_ENABLE_BARCODE 1 45 | #define GT_CFG_ENABLE_QRCODE 1 46 | #define GT_CFG_ENABLE_ZK_FONT 1 47 | #define GT_CFG_ENABLE_ZK_SPELL 1 48 | #define GT_CFG_ENABLE_LINE 1 49 | #define GT_CFG_ENABLE_PLAYER 1 50 | #define GT_CFG_ENABLE_INPUT_NUMBER 1 51 | #define GT_CFG_ENABLE_CLOCK 1 52 | #define GT_CFG_ENABLE_WORDART 1 53 | #define GT_CFG_ENABLE_VIEW_PAGER 1 54 | #define GT_CFG_ENABLE_ROLLER 1 55 | #define GT_CFG_ENABLE_BTNMAP 1 56 | #define GT_CFG_ENABLE_CHAT 1 57 | #define GT_CFG_ENABLE_GRAPHS 1 58 | #define GT_CFG_ENABLE_ARC 1 59 | #define GT_CFG_ENABLE_TABLE 1 60 | 61 | #if GT_USE_LAYER_TOP && GT_CFG_ENABLE_INPUT && GT_CFG_ENABLE_LISTVIEW 62 | #define GT_CFG_ENABLE_SELECT 1 63 | #endif 64 | 65 | #if GT_CFG_ENABLE_IMG && GT_CFG_ENABLE_SLIDER && GT_CFG_ENABLE_LABEL 66 | #define GT_CFG_ENABLE_MEDIA_PLAYER 1 67 | #endif 68 | 69 | #if GT_USE_LAYER_TOP 70 | #define GT_CFG_ENABLE_DIALOG 1 71 | #define GT_CFG_ENABLE_STATUS_BAR 1 72 | #endif 73 | 74 | #if GT_USE_GIF 75 | #define GT_CFG_ENABLE_GIF 1 76 | #endif 77 | 78 | #if GT_USE_MD4C && GT_CFG_ENABLE_TEXTAREA && GT_CFG_ENABLE_TABLE 79 | #define GT_CFG_ENABLE_MARKDOWN 1 80 | #endif 81 | 82 | #if GT_USE_SERIAL 83 | #define GT_CFG_ENABLE_BIT_IMG 1 84 | #endif 85 | /* typedef --------------------------------------------------------------*/ 86 | 87 | 88 | 89 | /* macros ---------------------------------------------------------------*/ 90 | 91 | 92 | 93 | /* global functions / API interface -------------------------------------*/ 94 | 95 | 96 | 97 | #ifdef __cplusplus 98 | } /*extern "C"*/ 99 | #endif 100 | 101 | #endif //!_GT_CONF_WIDGETS_H_ 102 | -------------------------------------------------------------------------------- /src/widgets/gt_gif.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_gif.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2023-10-24 16:32:21 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_GIF_H_ 10 | #define _GT_GIF_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_GIF 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | 23 | #if GT_USE_FILE_HEADER 24 | #include "../hal/gt_hal_file_header.h" 25 | #endif 26 | 27 | 28 | /* define ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* typedef --------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* macros ---------------------------------------------------------------*/ 37 | 38 | 39 | 40 | /* class ----------------------------------------------------------------*/ 41 | 42 | 43 | 44 | /* global functions / API interface -------------------------------------*/ 45 | 46 | gt_obj_st * gt_gif_create(gt_obj_st * parent); 47 | 48 | void gt_gif_set_src(gt_obj_st * obj, char * src); 49 | 50 | char * gt_gif_get_src(gt_obj_st * obj); 51 | 52 | #if GT_USE_FILE_HEADER 53 | /** 54 | * @brief 55 | * 56 | * @param obj 57 | * @param fh idx -1[defalut]: Disabled file header, using img path to open file; >=0: index number, valid value 58 | * < 0: invalid value. 59 | * package_idx 0[defalut]: The index of element within item, as the first element 60 | */ 61 | void gt_gif_set_src_by_file_header(gt_obj_st * obj, gt_file_header_param_st * fh); 62 | #endif 63 | 64 | #if GT_USE_DIRECT_ADDR 65 | /** 66 | * @brief Display the gif by direct address 67 | * 68 | * @param obj 69 | * @param addr Direct address of the gif 70 | */ 71 | void gt_gif_set_src_by_direct_addr(gt_obj_st * obj, gt_addr_t addr); 72 | #endif 73 | 74 | gt_size_t gt_gif_get_frame_width(gt_obj_st * obj); 75 | 76 | gt_size_t gt_gif_get_frame_height(gt_obj_st * obj); 77 | 78 | void gt_gif_play(gt_obj_st * obj); 79 | 80 | void gt_gif_stop(gt_obj_st * obj); 81 | 82 | void gt_gif_toggle(gt_obj_st * obj); 83 | 84 | bool gt_gif_is_play(gt_obj_st * obj); 85 | 86 | void gt_gif_reset(gt_obj_st * obj); 87 | 88 | 89 | 90 | #endif /** GT_CFG_ENABLE_GIF */ 91 | 92 | #ifdef __cplusplus 93 | } /*extern "C"*/ 94 | #endif 95 | 96 | #endif //!_GT_GIF_H_ 97 | -------------------------------------------------------------------------------- /src/widgets/gt_group.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_group.h 3 | * @author yongg 4 | * @brief The group of members control 5 | * @version 0.1 6 | * @date 2022-07-20 15:51:11 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_GROUP_H_ 10 | #define _GT_GROUP_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_GROUP 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* typedef --------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* global functions / API interface -------------------------------------*/ 36 | 37 | /** 38 | * @brief create group obj 39 | * 40 | * @param parent group's parent obj 41 | * @return gt_obj_st* group obj ptr 42 | */ 43 | gt_obj_st * gt_group_create(gt_obj_st * parent); 44 | 45 | /** 46 | * @brief According to the type of the object, get the selected or active object 47 | * 48 | * @param group Group object 49 | * @param type Widget type enum 50 | * @return gt_obj_st* The selected or active object 51 | */ 52 | gt_obj_st * gt_group_get_active_obj(gt_obj_st * group, gt_obj_type_et type); 53 | 54 | /** 55 | * @brief According to the type of the object, only set the first one object active 56 | * 57 | * @param group 58 | * @param type Widget type enum 59 | * @return true set success 60 | * @return false set failed 61 | */ 62 | bool gt_group_reset_selected_state(gt_obj_st * group, gt_obj_type_et type); 63 | 64 | 65 | #endif /** GT_CFG_ENABLE_GROUP */ 66 | 67 | #ifdef __cplusplus 68 | } /*extern "C"*/ 69 | #endif 70 | 71 | #endif //!_GT_GROUP_H_ 72 | -------------------------------------------------------------------------------- /src/widgets/gt_img.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_img.h 3 | * @author yongg 4 | * @brief image display control 5 | * @version 0.1 6 | * @date 2022-07-05 17:36:46 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_IMG_H_ 10 | #define _GT_IMG_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_IMG 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | #include "../others/gt_color.h" 23 | 24 | #if GT_USE_FILE_HEADER 25 | #include "../hal/gt_hal_file_header.h" 26 | #endif 27 | 28 | #if GT_USE_DIRECT_ADDR_CUSTOM_SIZE 29 | #include "../hal/gt_hal_fs.h" 30 | #endif 31 | 32 | /* define ---------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* typedef --------------------------------------------------------------*/ 37 | 38 | 39 | 40 | /* macros ---------------------------------------------------------------*/ 41 | 42 | 43 | 44 | /* global functions / API interface -------------------------------------*/ 45 | 46 | /** 47 | * @brief create img obj 48 | * 49 | * @param parent img's parent obj 50 | * @return gt_obj_st* img obj ptr 51 | */ 52 | gt_obj_st * gt_img_create(gt_obj_st * parent); 53 | 54 | /** 55 | * @brief set the path of the img 56 | * 57 | * @param img img obj 58 | * @param src path of img 59 | */ 60 | void gt_img_set_src(gt_obj_st * img, char * src); 61 | 62 | /** 63 | * @brief Display the image directly with raw data 64 | * 65 | * @param img img object 66 | * @param raw Raw data of the image 67 | */ 68 | void gt_img_set_raw_data(gt_obj_st * img, gt_color_img_raw_st * raw); 69 | 70 | #if GT_USE_FILE_HEADER 71 | /** 72 | * @brief Display the image by file header information 73 | * 74 | * @param img 75 | * @param fh idx -1[defalut]: Disabled file header, using img path to open file; >=0: index number, valid value 76 | * < 0: invalid value. 77 | * package_idx 0[defalut]: The index of element within item, as the first element 78 | */ 79 | void gt_img_set_by_file_header(gt_obj_st * img, gt_file_header_param_st * fh); 80 | 81 | gt_file_header_param_st* gt_img_get_file_header_param(gt_obj_st * img); 82 | #endif 83 | 84 | #if GT_USE_DIRECT_ADDR 85 | /** 86 | * @brief Display the image by direct address 87 | * 88 | * @param img 89 | * @param addr Direct address of the image 90 | */ 91 | void gt_img_set_by_direct_addr(gt_obj_st * img, gt_addr_t addr); 92 | #endif 93 | 94 | #if GT_USE_DIRECT_ADDR_CUSTOM_SIZE 95 | /** 96 | * @brief Display the image by custom size direct address 97 | * 98 | * @param img 99 | * @param dac Custom size direct address of the image 100 | */ 101 | void gt_img_set_by_custom_size_addr(gt_obj_st * img, gt_direct_addr_custom_size_st * dac); 102 | #endif 103 | 104 | /** 105 | * @brief get img src of path 106 | * 107 | * @param img img obj 108 | * @return char* src of img 109 | */ 110 | char * gt_img_get_src(gt_obj_st * img); 111 | 112 | /** 113 | * @brief Gets the width of the image 114 | * 115 | * @param img 116 | * @return uint16_t 117 | */ 118 | uint16_t gt_img_get_width(gt_obj_st * img); 119 | 120 | /** 121 | * @brief Gets the height of the image 122 | * 123 | * @param img 124 | * @return uint16_t 125 | */ 126 | uint16_t gt_img_get_height(gt_obj_st * img); 127 | 128 | 129 | #endif /** GT_CFG_ENABLE_IMG */ 130 | 131 | #ifdef __cplusplus 132 | } /*extern "C"*/ 133 | #endif 134 | 135 | #endif //!_GT_IMG_H_ 136 | -------------------------------------------------------------------------------- /src/widgets/gt_line.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_line.h 3 | * @author Li 4 | * @brief 5 | * @version 0.1 6 | * @date 2023-01-05 16:28:01 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_LINE_H_ 10 | #define _GT_LINE_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_LINE 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* typedef --------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* global functions / API interface -------------------------------------*/ 36 | /** 37 | * @brief create line obj 38 | * 39 | * @param parent line's parent obj 40 | * @return gt_obj_st* line obj ptr 41 | */ 42 | gt_obj_st * gt_line_create(gt_obj_st * parent); 43 | 44 | void gt_line_set_color(gt_obj_st * line, gt_color_t color); 45 | 46 | void gt_line_set_start_point(gt_obj_st * line, uint16_t xs, uint16_t ys); 47 | void gt_line_set_end_point(gt_obj_st * line, uint16_t xe, uint16_t ye); 48 | 49 | /** 50 | * @brief Set line length, set position by gt_obj_set_pos() 51 | * 52 | * @param line 53 | * @param length the length of the horizontal line 54 | */ 55 | void gt_line_set_hor_line(gt_obj_st * line, uint16_t length); 56 | 57 | /** 58 | * @brief Set line length, set position by gt_obj_set_pos() 59 | * 60 | * @param line 61 | * @param length the length of the vertical line 62 | */ 63 | void gt_line_set_ver_line(gt_obj_st * line, uint16_t length); 64 | 65 | void gt_line_set_line_width(gt_obj_st * line, uint16_t line_width); 66 | 67 | 68 | #endif /** GT_CFG_ENABLE_LINE */ 69 | 70 | #ifdef __cplusplus 71 | } /*extern "C"*/ 72 | #endif 73 | 74 | #endif //!_GT_LINE_H_ 75 | -------------------------------------------------------------------------------- /src/widgets/gt_markdown.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_markdown.h 3 | * @author Feyoung 4 | * @brief Markdown widget, using md4c library, support basic markdown syntax 5 | * such as: h1~h6, p, ul, ol, li, etc. 6 | * @version 0.1 7 | * @date 2024-12-10 10:24:44 8 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 9 | */ 10 | #ifndef _GT_MARKDOWN_H_ 11 | #define _GT_MARKDOWN_H_ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /* include --------------------------------------------------------------*/ 18 | #include "gt_conf_widgets.h" 19 | 20 | #if GT_CFG_ENABLE_MARKDOWN 21 | #include "gt_obj.h" 22 | #include "gt_obj_class.h" 23 | #include "../font/gt_font.h" 24 | #include "../others/gt_types.h" 25 | 26 | 27 | 28 | /* define ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* typedef --------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* macros ---------------------------------------------------------------*/ 37 | 38 | 39 | 40 | /* class ----------------------------------------------------------------*/ 41 | 42 | 43 | 44 | /* global functions / API interface -------------------------------------*/ 45 | /** 46 | * @brief Create a markdown content object 47 | * 48 | * @param parent 49 | * @return gt_obj_st* 50 | */ 51 | gt_obj_st * gt_markdown_create(gt_obj_st * parent); 52 | 53 | /** 54 | * @brief Set the markdown source text, 55 | * [Warn] Must after gt_obj_set_size() be called. 56 | * 57 | * @param markdown 58 | * @param text Markdown source text 59 | * @param len The length of the text 60 | */ 61 | void gt_markdown_set_text(gt_obj_st * markdown, const char * text, uint32_t len); 62 | 63 | void gt_markdown_set_font_info_large(gt_obj_st * markdown, gt_font_info_st * font_info); 64 | void gt_markdown_set_font_info_middle(gt_obj_st * markdown, gt_font_info_st * font_info); 65 | void gt_markdown_set_font_info_small(gt_obj_st * markdown, gt_font_info_st * font_info); 66 | 67 | gt_font_info_st * gt_markdown_get_font_info_large(gt_obj_st * markdown); 68 | gt_font_info_st * gt_markdown_get_font_info_middle(gt_obj_st * markdown); 69 | gt_font_info_st * gt_markdown_get_font_info_small(gt_obj_st * markdown); 70 | 71 | 72 | 73 | #endif /** GT_CFG_ENABLE_MARKDOWN */ 74 | 75 | #ifdef __cplusplus 76 | } /*extern "C"*/ 77 | #endif 78 | 79 | #endif //!_GT_MARKDOWN_H_ 80 | -------------------------------------------------------------------------------- /src/widgets/gt_media_player.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_media_player.h 3 | * @author Feyoung 4 | * @brief Media player control 5 | * @version 0.1 6 | * @date 2024-08-23 11:10:20 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_MEDIA_PLAYER_H_ 10 | #define _GT_MEDIA_PLAYER_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_MEDIA_PLAYER 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | #include "../others/gt_color.h" 23 | #include "./gt_img.h" 24 | #include "./gt_slider.h" 25 | 26 | 27 | /* define ---------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* typedef --------------------------------------------------------------*/ 32 | /** 33 | * @brief When media triggers the play or stop event, the callback function is called 34 | */ 35 | typedef void ( * gt_media_player_handler_cb)(gt_obj_st * obj, void * user_data); 36 | 37 | 38 | /* macros ---------------------------------------------------------------*/ 39 | 40 | 41 | 42 | /* class ----------------------------------------------------------------*/ 43 | 44 | 45 | 46 | /* global functions / API interface -------------------------------------*/ 47 | /** 48 | * @brief Create media player 49 | * 50 | * @param parent 51 | * @return gt_obj_st* 52 | */ 53 | gt_obj_st * gt_media_player_create(gt_obj_st * parent); 54 | 55 | /** 56 | * @brief Set the callback function when the media triggers the play event 57 | * 58 | * @param obj 59 | * @param play_cb Callback function 60 | * @param user_data 61 | */ 62 | void gt_media_player_set_play_cb(gt_obj_st * obj, gt_media_player_handler_cb play_cb, void * user_data); 63 | 64 | /** 65 | * @brief Set the callback function when the media triggers the stop event 66 | * 67 | * @param obj 68 | * @param stop_cb Callback function 69 | * @param user_data 70 | */ 71 | void gt_media_player_set_stop_cb(gt_obj_st * obj, gt_media_player_handler_cb stop_cb, void * user_data); 72 | 73 | /** 74 | * @brief Setting frame data 75 | * 76 | * @param obj 77 | * @param raw Raw data of the frame 78 | */ 79 | void gt_media_player_set_raw(gt_obj_st * obj, gt_color_img_raw_st * raw); 80 | 81 | /** 82 | * @brief Setting media total second time 83 | * 84 | * @param obj 85 | * @param total_time second[s] 86 | */ 87 | void gt_media_player_set_total_time(gt_obj_st * obj, gt_size_t total_time); 88 | 89 | /** 90 | * @brief Set the current second time of the media 91 | * 92 | * @param obj 93 | * @param current_time 94 | */ 95 | void gt_media_player_set_current_time(gt_obj_st * obj, gt_size_t current_time); 96 | 97 | /** 98 | * @brief Get the current second time of the media 99 | * 100 | * @param obj 101 | * @return gt_size_t second 102 | */ 103 | gt_size_t gt_media_player_get_current_time(gt_obj_st * obj); 104 | 105 | /** 106 | * @brief Calling by the slider bar to set the current time 107 | * 108 | * @param obj 109 | * @param value_change_cb Callback function 110 | * @param user_data 111 | */ 112 | void gt_media_player_set_slider_change_cb(gt_obj_st * obj, gt_event_cb_t value_change_cb, void * user_data); 113 | 114 | 115 | #endif /** GT_CFG_ENABLE_MEDIA_PLAYER */ 116 | 117 | #ifdef __cplusplus 118 | } /*extern "C"*/ 119 | #endif 120 | 121 | #endif //!_GT_MEDIA_PLAYER_H_ 122 | -------------------------------------------------------------------------------- /src/widgets/gt_obj_class.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_obj_class.h 3 | * @author yongg 4 | * @brief object class information 5 | * @version 0.1 6 | * @date 2022-05-12 10:34:16 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_OBJ_CLASS_H_ 10 | #define _GT_OBJ_CLASS_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../others/gt_types.h" 18 | #include "../core/gt_event.h" 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* typedef --------------------------------------------------------------*/ 25 | /** Control drawing logic */ 26 | typedef void (* _gt_init_cb_t)(struct gt_obj_s *); 27 | 28 | /** Can only be used to free additional memory requested by the control when it is created */ 29 | typedef void (* _gt_deinit_cb_t)(struct gt_obj_s *); 30 | 31 | /** Controls all behavior events */ 32 | typedef void (* _gt_event_cb_t)(struct gt_obj_s *, struct _gt_event_s *); 33 | 34 | /** 35 | * @brief interface for other widgets 36 | */ 37 | typedef struct _gt_obj_class_s { 38 | _gt_init_cb_t _init_cb; 39 | _gt_deinit_cb_t _deinit_cb; 40 | _gt_event_cb_t _event_cb; 41 | /** Control type @ref gt_obj_type_et */ 42 | gt_obj_type_et type; 43 | /** Control styles contain the memory size of the base object, 44 | * which must exist at the very front of the struct */ 45 | uint16_t size_style; 46 | }gt_obj_class_st; 47 | 48 | 49 | 50 | /* macros ---------------------------------------------------------------*/ 51 | 52 | 53 | 54 | /* global functions / API interface -------------------------------------*/ 55 | /** 56 | * @brief 57 | * 58 | * @param parent 59 | * @return struct gt_obj_s* 60 | */ 61 | struct gt_obj_s * gt_obj_class_create(const gt_obj_class_st * c, struct gt_obj_s * parent); 62 | 63 | /** 64 | * @brief Get widget type 65 | * 66 | * @param obj 67 | * @return gt_obj_type_et @see gt_obj_type_et 68 | */ 69 | gt_obj_type_et gt_obj_class_get_type(struct gt_obj_s * obj); 70 | 71 | /** 72 | * @brief Check if the object is target type, include NULL check 73 | * 74 | * @param obj 75 | * @param type GT_TYPE_TOTAL: select all types, except GT_TYPE_UNKNOWN 76 | * @return true 77 | * @return false 78 | */ 79 | bool gt_obj_is_type(struct gt_obj_s * obj, gt_obj_type_et type); 80 | 81 | /** 82 | * @brief Change the parent of the control widget. 83 | * 84 | * @param obj 85 | * @param to 86 | * @return struct gt_obj_s* parent pointer 87 | */ 88 | struct gt_obj_s * _gt_obj_class_change_parent(struct gt_obj_s * obj, struct gt_obj_s * to); 89 | 90 | /** 91 | * @brief delete control widget; Reclaim the memory of child controls, 92 | * immediately and recursively. 93 | * 94 | * @param self 95 | */ 96 | void _gt_obj_class_destroy(struct gt_obj_s * self); 97 | 98 | /** 99 | * @brief delete all child controls, immediately and recursively. 100 | * 101 | * @param self 102 | */ 103 | void _gt_obj_class_destroy_children(struct gt_obj_s * self); 104 | 105 | /** 106 | * @brief Multiple properties that can be inherited from the superclass 107 | * 108 | * @param obj The object to be inherited 109 | * @param parent The parent object 110 | */ 111 | void _gt_obj_class_inherent_attr_from_parent(struct gt_obj_s * obj, struct gt_obj_s * parent); 112 | 113 | #ifdef __cplusplus 114 | } /*extern "C"*/ 115 | #endif 116 | 117 | #endif //!_GT_OBJ_CLASS_H_ 118 | -------------------------------------------------------------------------------- /src/widgets/gt_option.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_option.h 3 | * @author yongg 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-07-18 13:59:53 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_OPTION_H_ 10 | #define _GT_OPTION_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_obj.h" 18 | #include "gt_obj_class.h" 19 | 20 | /* define ---------------------------------------------------------------*/ 21 | 22 | 23 | 24 | /* typedef --------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* macros ---------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* global functions / API interface -------------------------------------*/ 33 | gt_obj_st * gt_option_create(gt_obj_st * parent); 34 | 35 | 36 | #ifdef __cplusplus 37 | } /*extern "C"*/ 38 | #endif 39 | 40 | #endif //!_GT_OPTION_H_ 41 | -------------------------------------------------------------------------------- /src/widgets/gt_progress_bar.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_progress_bar.h 3 | * @author yongg 4 | * @brief The progress bar implementation 5 | * @version 0.1 6 | * @date 2022-07-22 14:13:28 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_PROGRESS_BAR_H_ 10 | #define _GT_PROGRESS_BAR_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_PROGRESS_BAR 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | #include "../core/gt_style.h" 23 | 24 | /* define ---------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* typedef --------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* macros ---------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* global functions / API interface -------------------------------------*/ 37 | 38 | /** 39 | * @brief create progress_bar obj 40 | * 41 | * @param parent progress_bar's parent obj 42 | * @return gt_obj_st* progress_bar obj ptr 43 | */ 44 | gt_obj_st * gt_progress_bar_create(gt_obj_st * parent); 45 | 46 | /** 47 | * @brief set progress_bar pos 48 | * 49 | * @param progress_bar progress_bar obj 50 | * @param pos pos 51 | */ 52 | void gt_progress_bar_set_pos(gt_obj_st * progress_bar, gt_size_t pos); 53 | 54 | /** 55 | * @brief set progress_bar start and end pos 56 | * 57 | * @param progress_bar progress_bar obj 58 | * @param start start pos 59 | * @param end end pos 60 | */ 61 | void gt_progress_bar_set_start_end(gt_obj_st * progress_bar, gt_size_t start, gt_size_t end); 62 | 63 | /** 64 | * @brief get progress_bar pos 65 | * 66 | * @param progress_bar progress_bar obj 67 | * @return gt_size_t progress_bar pos 68 | */ 69 | gt_size_t gt_progress_bar_get_pos(gt_obj_st * progress_bar); 70 | 71 | /** 72 | * @brief get progress_bar start pos 73 | * 74 | * @param progress_bar progress_bar obj 75 | * @return gt_size_t progress_bar start pos 76 | */ 77 | gt_size_t gt_progress_bar_get_start(gt_obj_st * progress_bar); 78 | 79 | /** 80 | * @brief get progress_bar end pos 81 | * 82 | * @param progress_bar progress_bar obj 83 | * @return gt_size_t progress_bar end pos 84 | */ 85 | gt_size_t gt_progress_bar_get_end(gt_obj_st * progress_bar); 86 | 87 | /** 88 | * @brief get progress_bar total pos 89 | * 90 | * @param progress_bar progress_bar obj 91 | * @return gt_size_t progress_bar total pos 92 | */ 93 | gt_size_t gt_progress_bar_get_total(gt_obj_st * progress_bar); 94 | 95 | 96 | void gt_progress_bar_set_color_act(gt_obj_st * progress_bar, gt_color_t color); 97 | void gt_progress_bar_set_color_ina(gt_obj_st * progress_bar, gt_color_t color); 98 | 99 | void gt_progress_bar_set_dir(gt_obj_st * progress_bar, gt_bar_dir_et dir); 100 | gt_bar_dir_et gt_progress_bar_get_dir(gt_obj_st * progress_bar); 101 | 102 | 103 | #endif /** GT_CFG_ENABLE_PROGRESS_BAR */ 104 | 105 | #ifdef __cplusplus 106 | } /*extern "C"*/ 107 | #endif 108 | 109 | #endif //!_GT_PROGRESS_BAR_H_ 110 | -------------------------------------------------------------------------------- /src/widgets/gt_qrcode.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_qrcode.h 3 | * @author yongg 4 | * @brief The QRCode implementation 5 | * @version 0.1 6 | * @date 2022-08-24 16:37:06 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_QRCODE_H_ 10 | #define _GT_QRCODE_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_QRCODE 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | #include "gt_conf_widgets.h" 23 | 24 | #ifdef GT_CONFIG_GUI_DRIVER_LIB 25 | #include "../../driver/gt_gui_driver.h" 26 | #endif /* GT_CONFIG_GUI_DRIVER_LIB */ 27 | 28 | 29 | /* define ---------------------------------------------------------------*/ 30 | 31 | /* typedef --------------------------------------------------------------*/ 32 | typedef enum qrcode_version_e { 33 | GT_FAMILY_QRCODE_VERSION_3 = 3, 34 | GT_FAMILY_QRCODE_VERSION_4, 35 | GT_FAMILY_QRCODE_VERSION_5, 36 | GT_FAMILY_QRCODE_VERSION_6, 37 | GT_FAMILY_QRCODE_VERSION_7, 38 | GT_FAMILY_QRCODE_VERSION_8, 39 | GT_FAMILY_QRCODE_VERSION_9, 40 | GT_FAMILY_QRCODE_VERSION_10, 41 | GT_FAMILY_QRCODE_VERSION_11, 42 | GT_FAMILY_QRCODE_VERSION_12, 43 | GT_FAMILY_QRCODE_VERSION_13, 44 | GT_FAMILY_QRCODE_VERSION_14, 45 | GT_FAMILY_QRCODE_VERSION_15, 46 | GT_FAMILY_QRCODE_VERSION_16, 47 | GT_FAMILY_QRCODE_VERSION_17 48 | }gt_qr_code_version_em; 49 | 50 | 51 | 52 | /* macros ---------------------------------------------------------------*/ 53 | 54 | 55 | 56 | /* global functions / API interface -------------------------------------*/ 57 | 58 | /** 59 | * @brief create QRCode obj 60 | * 61 | * @param parent QRCode's parent obj 62 | * @return gt_obj_st* QRCode obj ptr 63 | */ 64 | gt_obj_st * gt_qrcode_create(gt_obj_st * parent); 65 | 66 | void gt_qrcode_set_version(gt_obj_st * qr_code , gt_qr_code_version_em version); 67 | void gt_qrcode_set_str(gt_obj_st * qr_code , char* str); 68 | 69 | void gt_qrcode_set_background(gt_obj_st * qr_code , gt_color_t color); 70 | void gt_qrcode_set_forecolor(gt_obj_st * qr_code , gt_color_t color); 71 | 72 | 73 | #endif /** GT_CFG_ENABLE_QRCODE */ 74 | 75 | #ifdef __cplusplus 76 | } /*extern "C"*/ 77 | #endif 78 | 79 | #endif //!_GT_QRCODE_H_ 80 | -------------------------------------------------------------------------------- /src/widgets/gt_radio.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_radio.h 3 | * @author yongg 4 | * @brief The implementation of the radio 5 | * @version 0.1 6 | * @date 2022-07-20 15:29:01 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_RADIO_H_ 10 | #define _GT_RADIO_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_RADIO 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | #include "stdarg.h" 23 | #include "stdlib.h" 24 | #include "../font/gt_font.h" 25 | 26 | /* define ---------------------------------------------------------------*/ 27 | 28 | 29 | 30 | /* typedef --------------------------------------------------------------*/ 31 | 32 | 33 | 34 | /* macros ---------------------------------------------------------------*/ 35 | 36 | 37 | 38 | /* global functions / API interface -------------------------------------*/ 39 | 40 | /** 41 | * @brief create radio obj 42 | * 43 | * @param parent radio's parent obj 44 | * @return gt_obj_st* radio obj ptr 45 | */ 46 | gt_obj_st * gt_radio_create(gt_obj_st * parent); 47 | 48 | /** 49 | * @brief set radio state to selected 50 | * 51 | * @param radio radio obj 52 | */ 53 | void gt_radio_set_selected(gt_obj_st * radio); 54 | 55 | /** 56 | * @brief set radio text 57 | * 58 | * @param radio radio obj 59 | * @param fmt text format 60 | */ 61 | void gt_radio_set_text(gt_obj_st * radio, const char * fmt, ...); 62 | 63 | void gt_radio_set_text_by_len(gt_obj_st * radio, const char * text, uint16_t len); 64 | 65 | void gt_radio_set_font_color(gt_obj_st * radio, gt_color_t color); 66 | void gt_radio_set_font_size(gt_obj_st * radio, uint8_t size); 67 | void gt_radio_set_font_gray(gt_obj_st * radio, uint8_t gray); 68 | #if (defined(GT_FONT_FAMILY_OLD_ENABLE) && (GT_FONT_FAMILY_OLD_ENABLE == 1)) 69 | void gt_radio_set_font_family_cn(gt_obj_st * radio, gt_family_t family); 70 | void gt_radio_set_font_family_en(gt_obj_st * radio, gt_family_t family); 71 | void gt_radio_set_font_family_fl(gt_obj_st * radio, gt_family_t family); 72 | void gt_radio_set_font_family_numb(gt_obj_st * radio, gt_family_t family); 73 | #else 74 | void gt_radio_set_font_family(gt_obj_st * radio, gt_family_t family); 75 | void gt_radio_set_font_cjk(gt_obj_st* radio, gt_font_cjk_et cjk); 76 | #endif 77 | void gt_radio_set_font_thick_en(gt_obj_st * radio, uint8_t thick); 78 | void gt_radio_set_font_thick_cn(gt_obj_st * radio, uint8_t thick); 79 | void gt_radio_set_font_encoding(gt_obj_st * radio, gt_encoding_et encoding); 80 | void gt_radio_set_font_style(gt_obj_st * radio, gt_font_style_et font_style); 81 | void gt_radio_set_space(gt_obj_st * radio, uint8_t space_x, uint8_t space_y); 82 | 83 | void gt_radio_set_font_point_offset_x(gt_obj_st * radio , gt_size_t x); 84 | void gt_radio_set_font_point_offset_y(gt_obj_st * radio , gt_size_t y); 85 | void gt_radio_set_font_point_offset(gt_obj_st * radio , gt_size_t x , gt_size_t y); 86 | 87 | 88 | #endif /** GT_CFG_ENABLE_RADIO */ 89 | 90 | #ifdef __cplusplus 91 | } /*extern "C"*/ 92 | #endif 93 | 94 | #endif //!_GT_RADIO_H_ 95 | -------------------------------------------------------------------------------- /src/widgets/gt_rect.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_rect.h 3 | * @author yongg 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-11-02 09:50:08 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_RECT_H_ 10 | #define _GT_RECT_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_RECT 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* typedef --------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* global functions / API interface -------------------------------------*/ 36 | 37 | /** 38 | * @brief create rect obj 39 | * 40 | * @param parent rect's parent obj 41 | * @return gt_obj_st* rect obj ptr 42 | */ 43 | gt_obj_st * gt_rect_create(gt_obj_st * parent); 44 | 45 | void gt_rect_set_bg_color(gt_obj_st * rect, gt_color_t color); 46 | void gt_rect_set_color_border(gt_obj_st * rect, gt_color_t color); 47 | void gt_rect_set_radius(gt_obj_st * rect, gt_radius_t radius); 48 | void gt_rect_set_border(gt_obj_st * rect, uint16_t border); 49 | void gt_rect_set_fill(gt_obj_st * rect, uint8_t is_full); 50 | 51 | 52 | #endif /** GT_CFG_ENABLE_RECT */ 53 | 54 | #ifdef __cplusplus 55 | } /*extern "C"*/ 56 | #endif 57 | 58 | #endif //!_GT_RECT_H_ 59 | -------------------------------------------------------------------------------- /src/widgets/gt_select.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_select.h 3 | * @author Feyoung 4 | * @brief Combined controls are composed of input box controls and list controls. 5 | * Listening GT_EVENT_TYPE_UPDATE_VALUE event to get the selected gt_input_hide_value. 6 | * Get the select item text such as: 7 | * ``` 8 | * static void _select_cb(gt_event_st * e) { 9 | * if (e->param) { 10 | * GT_LOG_A("", "select: [%s]", e->param); 11 | * } 12 | * } 13 | * ``` 14 | * @version 0.1 15 | * @date 2024-12-03 15:59:26 16 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 17 | */ 18 | #ifndef _GT_SELECT_H_ 19 | #define _GT_SELECT_H_ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* include --------------------------------------------------------------*/ 26 | #include "gt_conf_widgets.h" 27 | 28 | #if GT_CFG_ENABLE_SELECT 29 | #include "gt_obj.h" 30 | #include "gt_obj_class.h" 31 | #include "stdarg.h" 32 | #include "stdlib.h" 33 | #include "../core/gt_style.h" 34 | #include "../font/gt_font.h" 35 | 36 | 37 | 38 | /* define ---------------------------------------------------------------*/ 39 | 40 | 41 | 42 | /* typedef --------------------------------------------------------------*/ 43 | 44 | 45 | 46 | /* macros ---------------------------------------------------------------*/ 47 | 48 | 49 | 50 | /* class ----------------------------------------------------------------*/ 51 | 52 | 53 | 54 | /* global functions / API interface -------------------------------------*/ 55 | /** 56 | * @brief Create a select widget, detail @see gt_select.h's "brief" comments 57 | * 58 | * @param parent 59 | * @return gt_obj_st* 60 | */ 61 | gt_obj_st * gt_select_create(gt_obj_st * parent); 62 | 63 | void gt_select_add_option(gt_obj_st * obj, const char * text); 64 | void gt_select_clear_all_options(gt_obj_st * obj); 65 | void gt_select_set_option_height(gt_obj_st * obj, uint16_t height); 66 | 67 | void gt_select_set_font_color(gt_obj_st * select, gt_color_t color); 68 | void gt_select_set_font_size(gt_obj_st * select, uint8_t size); 69 | void gt_select_set_font_gray(gt_obj_st * select, uint8_t gray); 70 | void gt_select_set_font_align(gt_obj_st * select, gt_align_et align); 71 | #if (defined(GT_FONT_FAMILY_OLD_ENABLE) && (GT_FONT_FAMILY_OLD_ENABLE == 1)) 72 | void gt_select_set_font_family_cn(gt_obj_st * select, gt_family_t family); 73 | void gt_select_set_font_family_en(gt_obj_st * select, gt_family_t family); 74 | void gt_select_set_font_family_fl(gt_obj_st * select, gt_family_t family); 75 | void gt_select_set_font_family_numb(gt_obj_st * select, gt_family_t family); 76 | #else 77 | void gt_select_set_font_family(gt_obj_st * select, gt_family_t family); 78 | void gt_select_set_font_cjk(gt_obj_st* select, gt_font_cjk_et cjk); 79 | #endif 80 | void gt_select_set_font_thick_en(gt_obj_st * select, uint8_t thick); 81 | void gt_select_set_font_thick_cn(gt_obj_st * select, uint8_t thick); 82 | void gt_select_set_font_encoding(gt_obj_st * select, gt_encoding_et encoding); 83 | 84 | void gt_select_set_font_style(gt_obj_st * select, gt_font_style_et font_style); 85 | 86 | #endif /** GT_CFG_ENABLE_SELECT */ 87 | 88 | #ifdef __cplusplus 89 | } /*extern "C"*/ 90 | #endif 91 | 92 | #endif //!_GT_SELECT_H_ 93 | -------------------------------------------------------------------------------- /src/widgets/gt_switch.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_switch.h 3 | * @author yongg 4 | * @brief switch controller 5 | * @version 0.1 6 | * @date 2022-07-21 14:34:33 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_SWITCH_H_ 10 | #define _GT_SWITCH_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_SWITCH 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | #include "../core/gt_style.h" 23 | 24 | /* define ---------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* typedef --------------------------------------------------------------*/ 29 | typedef enum gt_switch_style_e { 30 | GT_SWITCH_STYLE_DEFAULT = 0, /** Focus tag is round style */ 31 | GT_SWITCH_STYLE_RECT, /** Focus tag is rect style */ 32 | GT_SWITCH_STYLE_AXIS, /** Thin axis style */ 33 | }gt_switch_style_et; 34 | 35 | 36 | 37 | /* macros ---------------------------------------------------------------*/ 38 | 39 | 40 | 41 | /* global functions / API interface -------------------------------------*/ 42 | 43 | /** 44 | * @brief create switch obj 45 | * 46 | * @param parent switch's parent obj 47 | * @return gt_obj_st* switch obj ptr 48 | */ 49 | gt_obj_st * gt_switch_create(gt_obj_st * parent); 50 | 51 | /** 52 | * @brief active color 53 | * 54 | * @param switcher 55 | * @param color default: 0x13ce66 56 | */ 57 | void gt_switch_set_color_act(gt_obj_st * switcher, gt_color_t color); 58 | 59 | /** 60 | * @brief inactivate color 61 | * 62 | * @param switcher 63 | * @param color default: 0xebeef5 64 | */ 65 | void gt_switch_set_color_ina(gt_obj_st * switcher, gt_color_t color); 66 | 67 | /** 68 | * @brief focus point color 69 | * 70 | * @param switcher 71 | * @param color default: 0xffffff 72 | */ 73 | void gt_switch_set_color_point(gt_obj_st * switcher, gt_color_t color); 74 | 75 | /** 76 | * @brief Set the dividing line color 77 | * 78 | * @param switcher 79 | * @param color Default: 0xdcdfe6 80 | */ 81 | void gt_switch_set_color_divider(gt_obj_st * switcher, gt_color_t color); 82 | 83 | /** 84 | * @brief set switcher style 85 | * 86 | * @param switcher 87 | * @param sw_style 88 | */ 89 | void gt_switch_set_style(gt_obj_st * switcher, gt_switch_style_et sw_style); 90 | 91 | /** 92 | * @brief Set the switcher's dividing line 93 | * 94 | * @param switcher 95 | * @param is_div_line 96 | */ 97 | void gt_switch_set_div_line(gt_obj_st * switcher, bool is_div_line); 98 | 99 | /** 100 | * @brief Set the dividing line size 101 | * 102 | * @param switcher 103 | * @param width 0[default]: auto calc size 104 | * @param height 0[default]: auto calc size 105 | */ 106 | void gt_switch_set_div_line_size(gt_obj_st * switcher, uint16_t width, uint16_t height); 107 | 108 | #endif /** GT_CFG_ENABLE_SWITCH */ 109 | 110 | #ifdef __cplusplus 111 | } /*extern "C"*/ 112 | #endif 113 | 114 | #endif //!_GT_SWITCH_H_ 115 | -------------------------------------------------------------------------------- /src/widgets/gt_table.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_table.h 3 | * @author Feyoung 4 | * @brief Table widget, support multi-row and multi-column table 5 | * @version 0.1 6 | * @date 2024-12-19 17:35:47 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_TABLE_H_ 10 | #define _GT_TABLE_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "./gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_TABLE 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | #include "../core/gt_style.h" 23 | #include "../font/gt_font.h" 24 | 25 | /* define ---------------------------------------------------------------*/ 26 | 27 | 28 | 29 | /* typedef --------------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* macros ---------------------------------------------------------------*/ 34 | 35 | 36 | 37 | /* class ----------------------------------------------------------------*/ 38 | 39 | 40 | 41 | /* global functions / API interface -------------------------------------*/ 42 | /** 43 | * @brief Create a table / form object 44 | * 45 | * @param parent 46 | * @return gt_obj_st* 47 | */ 48 | gt_obj_st * gt_table_create(gt_obj_st * parent); 49 | 50 | /** 51 | * @brief Add a header text to the table, Determines the 52 | * number of columns in the list 53 | * 54 | * @param table 55 | * @param text 56 | * @param len 57 | * @param align @ref gt_align_et recommend: 58 | * GT_ALIGN_LEFT_MID / GT_ALIGN_CENTER_MID / GT_ALIGN_RIGHT_MID 59 | * @return gt_res_t 60 | */ 61 | gt_res_t gt_table_add_header_text_by_len(gt_obj_st * table, char * text, uint16_t len, gt_align_et align); 62 | 63 | /** 64 | * @brief Add a content text to the table, Automatically 65 | * switches to the next line for content filling 66 | * 67 | * @param table 68 | * @param text 69 | * @param len 70 | * @return gt_res_t 71 | */ 72 | gt_res_t gt_table_add_content_text_by_len(gt_obj_st * table, char * text, uint16_t len); 73 | 74 | gt_res_t gt_table_refresh(gt_obj_st * table); 75 | 76 | #ifdef __cplusplus 77 | } /*extern "C"*/ 78 | #endif 79 | 80 | #endif /** GT_CFG_ENABLE_TABLE */ 81 | #endif //!_GT_TABLE_H_ 82 | -------------------------------------------------------------------------------- /src/widgets/gt_template.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_template.h 3 | * @author yongg 4 | * @brief 5 | * @version 0.1 6 | * @date 2022-07-18 13:55:20 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_TEMPLATE_H_ 10 | #define _GT_TEMPLATE_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_TEMPLATE 20 | #include "gt_obj.h" 21 | #include "gt_obj_class.h" 22 | 23 | /* define ---------------------------------------------------------------*/ 24 | 25 | 26 | 27 | /* typedef --------------------------------------------------------------*/ 28 | 29 | 30 | 31 | /* macros ---------------------------------------------------------------*/ 32 | 33 | 34 | 35 | /* global functions / API interface -------------------------------------*/ 36 | gt_obj_st * gt_template_create(gt_obj_st * parent); 37 | 38 | #endif /** GT_CFG_ENABLE_TEMPLATE */ 39 | 40 | #ifdef __cplusplus 41 | } /*extern "C"*/ 42 | #endif 43 | 44 | #endif //!_GT_TEMPLATE_H_ 45 | -------------------------------------------------------------------------------- /src/widgets/gt_view_pager.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_view_pager.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2023-10-07 14:39:28 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_VIEW_PAGER_H_ 10 | #define _GT_VIEW_PAGER_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_conf_widgets.h" 18 | 19 | #if GT_CFG_ENABLE_VIEW_PAGER 20 | #include "stdbool.h" 21 | #include "gt_obj.h" 22 | 23 | 24 | /* define ---------------------------------------------------------------*/ 25 | 26 | 27 | 28 | /* typedef --------------------------------------------------------------*/ 29 | 30 | 31 | 32 | /* macros ---------------------------------------------------------------*/ 33 | 34 | 35 | 36 | /* class ----------------------------------------------------------------*/ 37 | 38 | 39 | 40 | /* global functions / API interface -------------------------------------*/ 41 | 42 | /** 43 | * @brief create a view pager object 44 | * 45 | * @param parent 46 | * @return gt_obj_st* 47 | */ 48 | gt_obj_st * gt_view_pager_create(gt_obj_st * parent); 49 | 50 | /** 51 | * @brief Set the total number of fragments 52 | * 53 | * @param obj 54 | * @param count The total number of fragments, maximum @see _MAX_VIEW_PAGER_COUNT 55 | * @return int8_t The fragment count 56 | */ 57 | int8_t gt_view_pager_set_fragment_count(gt_obj_st * obj, uint8_t count); 58 | 59 | /** 60 | * @brief view pager scroll to target fragment index 61 | * 62 | * @param obj 63 | * @param index The target fragment index 64 | */ 65 | void gt_view_pager_scroll_to_fragment(gt_obj_st * obj, gt_size_t index); 66 | 67 | /** 68 | * @brief add a fragment 69 | * 70 | * @param obj 71 | * @return int8_t 72 | */ 73 | int8_t gt_view_pager_add_fragment(gt_obj_st * obj); 74 | 75 | /** 76 | * @brief Add widget into the view pager 77 | * 78 | * @param view_pager 79 | * @param fragment_idx 80 | * @param child 81 | */ 82 | void gt_view_pager_fragment_add_widget(gt_obj_st * view_pager, uint8_t fragment_idx, gt_obj_st * child); 83 | 84 | /** 85 | * @brief Get the fragment index of the child widget belong 86 | * 87 | * @param view_pager 88 | * @param child The child widget which want to be found 89 | * @return gt_size_t -1: not found 90 | */ 91 | gt_size_t gt_view_pager_get_widget_belong_fragment(gt_obj_st * view_pager, gt_obj_st * child); 92 | 93 | /** 94 | * @brief Enabled or disabled the background glass effect 95 | * 96 | * @param obj 97 | * @param enabled 98 | */ 99 | void gt_view_pager_set_glass(gt_obj_st * obj, bool enabled); 100 | bool gt_view_pager_get_glass(gt_obj_st * obj); 101 | 102 | /** 103 | * @brief Set background glass color 104 | * 105 | * @param obj 106 | * @param color 107 | */ 108 | void gt_view_pager_set_glass_color(gt_obj_st * obj, gt_color_t color); 109 | gt_color_t gt_view_pager_get_glass_color(gt_obj_st * obj); 110 | 111 | 112 | #endif /** GT_CFG_ENABLE_VIEW_PAGER */ 113 | 114 | #ifdef __cplusplus 115 | } /*extern "C"*/ 116 | #endif 117 | 118 | #endif //!_GT_VIEW_PAGE_H_ 119 | -------------------------------------------------------------------------------- /src/widgets/gt_widgets.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/widgets/*.c)) 2 | 3 | 4 | DEPPATH += --dep-path $(HMI_DIR)/src/widgets 5 | VPATH += :$(HMI_DIR)/src/widgets 6 | 7 | CFLAGS += "-I$(HMI_DIR)/src/widgets" 8 | 9 | 10 | # serial 11 | DEPPATH += --dep-path $(HMI_DIR)/src/widgets/serial 12 | VPATH += :$(HMI_DIR)/src/widgets/serial 13 | 14 | CFLAGS += "-I$(HMI_DIR)/src/widgets/serial" 15 | -------------------------------------------------------------------------------- /src/widgets/gt_wordart.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_wordart.h 3 | * @author Yang 4 | * @brief 5 | * @version 0.1 6 | * @date 2023-07-21 14:10:24 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_WORDART_H_ 10 | #define _GT_WORDART_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "gt_obj.h" 18 | #include "gt_obj_class.h" 19 | #include "stdarg.h" 20 | #include "stdlib.h" 21 | #include "gt_conf_widgets.h" 22 | 23 | #if GT_CFG_ENABLE_WORDART 24 | 25 | #if GT_USE_FILE_HEADER 26 | #include "../hal/gt_hal_file_header.h" 27 | #endif 28 | 29 | #if GT_USE_DIRECT_ADDR_CUSTOM_SIZE 30 | #include "../hal/gt_hal_fs.h" 31 | #endif 32 | 33 | /* define ---------------------------------------------------------------*/ 34 | 35 | 36 | 37 | /* typedef --------------------------------------------------------------*/ 38 | 39 | 40 | 41 | /* macros ---------------------------------------------------------------*/ 42 | 43 | 44 | 45 | /* global functions / API interface -------------------------------------*/ 46 | gt_obj_st * gt_wordart_create(gt_obj_st * parent); 47 | 48 | /** 49 | * @brief Example Initialize the maximum number of items 50 | * 51 | * @param wordart obj 52 | * @param total maximum number 53 | * @return valid number count of items 54 | */ 55 | uint32_t gt_wordart_items_init(gt_obj_st* wordart, uint32_t total); 56 | 57 | /** 58 | * @brief add item 59 | * 60 | * @param wordart obj 61 | * @param coding custom unicode 62 | * @param src image path 63 | */ 64 | void gt_wordart_add_item(gt_obj_st* wordart, uint32_t coding, char * src); 65 | 66 | #if GT_USE_FILE_HEADER 67 | /** 68 | * @brief add item by file header 69 | * 70 | * @param wordart 71 | * @param encode 72 | * @param fh idx -1[defalut]: Disabled file header, using img path to open file; >=0: index number, valid value 73 | * < 0: invalid value. 74 | * package_idx 0[defalut]: The index of element within item, as the first element 75 | */ 76 | void gt_wordart_add_item_by_file_header(gt_obj_st * wordart, uint32_t encode, gt_file_header_param_st const * fh); 77 | #endif 78 | 79 | #if GT_USE_DIRECT_ADDR 80 | /** 81 | * @brief add item by direct address 82 | * 83 | * @param wordart 84 | * @param encode 85 | * @param addr 86 | */ 87 | void gt_wordart_add_item_by_direct_addr(gt_obj_st * wordart, uint32_t encode, gt_addr_t addr); 88 | #endif 89 | 90 | #if GT_USE_DIRECT_ADDR_CUSTOM_SIZE 91 | /** 92 | * @brief add item by custom size direct address 93 | * 94 | * @param wordart 95 | * @param encode 96 | * @param dac custom size direct address 97 | */ 98 | void gt_wordart_add_item_by_custom_size_addr(gt_obj_st * wordart, uint32_t encode, gt_direct_addr_custom_size_st * dac); 99 | #endif 100 | 101 | void gt_wordart_remove_all_items(gt_obj_st * wordart); 102 | uint32_t gt_wordart_get_items_count(gt_obj_st * wordart); 103 | 104 | /** 105 | * @brief Set the text, which display by wordart image character 106 | * 107 | * @param wordart 108 | * @param fmt 109 | */ 110 | void gt_wordart_set_text(gt_obj_st * wordart, const char * fmt, ...); 111 | 112 | void gt_wordart_set_text_by_len(gt_obj_st * wordart, const char * text, uint16_t len); 113 | 114 | char * gt_wordart_get_text(gt_obj_st * wordart); 115 | 116 | void gt_wordart_set_space(gt_obj_st * wordart, uint8_t space_x, uint8_t space_y); 117 | 118 | void gt_wordart_set_number(gt_obj_st * wordart, double number, 119 | uint8_t integer_len, uint8_t decimal_len, 120 | bool is_float); 121 | #endif /* GT_CFG_ENABLE_WORDART */ 122 | 123 | #ifdef __cplusplus 124 | } /*extern "C"*/ 125 | #endif 126 | 127 | #endif //!_GT_WORDART_H_ 128 | 129 | /* end of file ----------------------------------------------------------*/ 130 | 131 | 132 | -------------------------------------------------------------------------------- /src/widgets/serial/gt_widgets_serial.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/src/widgets/serial/*.c)) 2 | 3 | 4 | DEPPATH += --dep-path $(HMI_DIR)/src/widgets/serial 5 | VPATH += :$(HMI_DIR)/src/widgets/serial 6 | 7 | CFLAGS += "-I$(HMI_DIR)/src/widgets/serial" 8 | -------------------------------------------------------------------------------- /test/gt_test.mk: -------------------------------------------------------------------------------- 1 | CSRCS += $(notdir $(wildcard $(HMI_DIR)/test/*.c)) 2 | 3 | DEPPATH += --dep-path $(HMI_DIR)/test 4 | VPATH += :$(HMI_DIR)/test 5 | 6 | CFLAGS += "-I$(HMI_DIR)/test" -------------------------------------------------------------------------------- /test/gt_test_rand_widget.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gt_test_rand_widget.h 3 | * @author Feyoung 4 | * @brief 5 | * @version 0.1 6 | * @date 2024-06-29 13:33:54 7 | * @copyright Copyright (c) 2014-present, Company Genitop. Co., Ltd. 8 | */ 9 | #ifndef _GT_TEST_RAND_WIDGET_H_ 10 | #define _GT_TEST_RAND_WIDGET_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* include --------------------------------------------------------------*/ 17 | #include "../src/gt_conf.h" 18 | #if _GT_USE_TEST 19 | 20 | #ifndef _GT_TEST_RAND_WIDGET_EVENT 21 | /** 22 | * @brief Control random click event test 23 | */ 24 | #define _GT_TEST_RAND_WIDGET_EVENT 0 25 | #endif 26 | 27 | #if _GT_TEST_RAND_WIDGET_EVENT 28 | 29 | /* define ---------------------------------------------------------------*/ 30 | 31 | 32 | 33 | /* typedef --------------------------------------------------------------*/ 34 | 35 | 36 | 37 | /* macros ---------------------------------------------------------------*/ 38 | 39 | 40 | 41 | /* class ----------------------------------------------------------------*/ 42 | 43 | 44 | 45 | /* global functions / API interface -------------------------------------*/ 46 | void _gt_test_rand_widget(void); 47 | 48 | 49 | #endif /** _GT_TEST_RAND_WIDGET_EVENT */ 50 | #endif /** _GT_USE_TEST */ 51 | 52 | #ifdef __cplusplus 53 | } /*extern "C"*/ 54 | #endif 55 | 56 | #endif //!_GT_TEST_RAND_WIDGET_H_ 57 | --------------------------------------------------------------------------------