├── .gitattributes ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── SConscript ├── example ├── SConscript ├── littlevgl2rtt_demo.c ├── lv_test_theme.c └── lv_test_theme.h ├── littlevgl2rtt.c ├── littlevgl2rtt.h ├── lv_conf.h ├── lvgl.h ├── lvgl ├── .github │ └── stale.yml ├── .gitignore ├── README.md ├── SConscript ├── docs │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ ├── astyle_c │ └── astyle_h ├── licence.txt ├── lv_api_map.h ├── lv_conf_internal.h ├── lv_conf_kconfig.h ├── lv_conf_templ.h ├── lv_core │ ├── lv_core.mk │ ├── lv_disp.c │ ├── lv_disp.h │ ├── lv_group.c │ ├── lv_group.h │ ├── lv_indev.c │ ├── lv_indev.h │ ├── lv_obj.c │ ├── lv_obj.h │ ├── lv_obj_style_dec.h │ ├── lv_refr.c │ ├── lv_refr.h │ ├── lv_style.c │ └── lv_style.h ├── lv_draw │ ├── lv_draw.h │ ├── lv_draw.mk │ ├── lv_draw_arc.c │ ├── lv_draw_arc.h │ ├── lv_draw_blend.c │ ├── lv_draw_blend.h │ ├── lv_draw_img.c │ ├── lv_draw_img.h │ ├── lv_draw_label.c │ ├── lv_draw_label.h │ ├── lv_draw_line.c │ ├── lv_draw_line.h │ ├── lv_draw_mask.c │ ├── lv_draw_mask.h │ ├── lv_draw_rect.c │ ├── lv_draw_rect.h │ ├── lv_draw_triangle.c │ ├── lv_draw_triangle.h │ ├── lv_img_buf.c │ ├── lv_img_buf.h │ ├── lv_img_cache.c │ ├── lv_img_cache.h │ ├── lv_img_decoder.c │ └── lv_img_decoder.h ├── lv_font │ ├── lv_font.c │ ├── lv_font.h │ ├── lv_font.mk │ ├── lv_font_dejavu_16_persian_hebrew.c │ ├── lv_font_fmt_txt.c │ ├── lv_font_fmt_txt.h │ ├── lv_font_loader.c │ ├── lv_font_loader.h │ ├── lv_font_montserrat_10.c │ ├── lv_font_montserrat_12.c │ ├── lv_font_montserrat_12_subpx.c │ ├── lv_font_montserrat_14.c │ ├── lv_font_montserrat_16.c │ ├── lv_font_montserrat_18.c │ ├── lv_font_montserrat_20.c │ ├── lv_font_montserrat_22.c │ ├── lv_font_montserrat_24.c │ ├── lv_font_montserrat_26.c │ ├── lv_font_montserrat_28.c │ ├── lv_font_montserrat_28_compressed.c │ ├── lv_font_montserrat_30.c │ ├── lv_font_montserrat_32.c │ ├── lv_font_montserrat_34.c │ ├── lv_font_montserrat_36.c │ ├── lv_font_montserrat_38.c │ ├── lv_font_montserrat_40.c │ ├── lv_font_montserrat_42.c │ ├── lv_font_montserrat_44.c │ ├── lv_font_montserrat_46.c │ ├── lv_font_montserrat_48.c │ ├── lv_font_montserrat_8.c │ ├── lv_font_simsun_16_cjk.c │ ├── lv_font_unscii_8.c │ └── lv_symbol_def.h ├── lv_gpu │ ├── lv_gpu.mk │ ├── lv_gpu_nxp_pxp.c │ ├── lv_gpu_nxp_pxp.h │ ├── lv_gpu_nxp_pxp_osa.c │ ├── lv_gpu_nxp_pxp_osa.h │ ├── lv_gpu_nxp_vglite.c │ ├── lv_gpu_nxp_vglite.h │ ├── lv_gpu_stm32_dma2d.c │ └── lv_gpu_stm32_dma2d.h ├── lv_hal │ ├── lv_hal.h │ ├── lv_hal.mk │ ├── lv_hal_disp.c │ ├── lv_hal_disp.h │ ├── lv_hal_indev.c │ ├── lv_hal_indev.h │ ├── lv_hal_tick.c │ └── lv_hal_tick.h ├── lv_misc │ ├── lv_anim.c │ ├── lv_anim.h │ ├── lv_area.c │ ├── lv_area.h │ ├── lv_async.c │ ├── lv_async.h │ ├── lv_bidi.c │ ├── lv_bidi.h │ ├── lv_color.c │ ├── lv_color.h │ ├── lv_debug.c │ ├── lv_debug.h │ ├── lv_fs.c │ ├── lv_fs.h │ ├── lv_gc.c │ ├── lv_gc.h │ ├── lv_ll.c │ ├── lv_ll.h │ ├── lv_log.c │ ├── lv_log.h │ ├── lv_math.c │ ├── lv_math.h │ ├── lv_mem.c │ ├── lv_mem.h │ ├── lv_misc.mk │ ├── lv_printf.c │ ├── lv_printf.h │ ├── lv_task.c │ ├── lv_task.h │ ├── lv_templ.c │ ├── lv_templ.h │ ├── lv_txt.c │ ├── lv_txt.h │ ├── lv_txt_ap.c │ ├── lv_txt_ap.h │ ├── lv_types.h │ ├── lv_utils.c │ └── lv_utils.h ├── lv_themes │ ├── lv_theme.c │ ├── lv_theme.h │ ├── lv_theme_empty.c │ ├── lv_theme_empty.h │ ├── lv_theme_material.c │ ├── lv_theme_material.h │ ├── lv_theme_mono.c │ ├── lv_theme_mono.h │ ├── lv_theme_template.c │ ├── lv_theme_template.h │ └── lv_themes.mk ├── lv_widgets │ ├── lv_arc.c │ ├── lv_arc.h │ ├── lv_bar.c │ ├── lv_bar.h │ ├── lv_btn.c │ ├── lv_btn.h │ ├── lv_btnmatrix.c │ ├── lv_btnmatrix.h │ ├── lv_calendar.c │ ├── lv_calendar.h │ ├── lv_canvas.c │ ├── lv_canvas.h │ ├── lv_chart.c │ ├── lv_chart.h │ ├── lv_checkbox.c │ ├── lv_checkbox.h │ ├── lv_cont.c │ ├── lv_cont.h │ ├── lv_cpicker.c │ ├── lv_cpicker.h │ ├── lv_dropdown.c │ ├── lv_dropdown.h │ ├── lv_gauge.c │ ├── lv_gauge.h │ ├── lv_img.c │ ├── lv_img.h │ ├── lv_imgbtn.c │ ├── lv_imgbtn.h │ ├── lv_keyboard.c │ ├── lv_keyboard.h │ ├── lv_label.c │ ├── lv_label.h │ ├── lv_led.c │ ├── lv_led.h │ ├── lv_line.c │ ├── lv_line.h │ ├── lv_linemeter.c │ ├── lv_linemeter.h │ ├── lv_list.c │ ├── lv_list.h │ ├── lv_msgbox.c │ ├── lv_msgbox.h │ ├── lv_objmask.c │ ├── lv_objmask.h │ ├── lv_page.c │ ├── lv_page.h │ ├── lv_roller.c │ ├── lv_roller.h │ ├── lv_slider.c │ ├── lv_slider.h │ ├── lv_spinbox.c │ ├── lv_spinbox.h │ ├── lv_spinner.c │ ├── lv_spinner.h │ ├── lv_switch.c │ ├── lv_switch.h │ ├── lv_table.c │ ├── lv_table.h │ ├── lv_tabview.c │ ├── lv_tabview.h │ ├── lv_textarea.c │ ├── lv_textarea.h │ ├── lv_tileview.c │ ├── lv_tileview.h │ ├── lv_widgets.mk │ ├── lv_win.c │ └── lv_win.h └── lvgl.h └── tools ├── pkg_scons └── rtconfig.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | 54 | # vscode files 55 | .vscode/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | # 编译信息邮件通知: 4 | notifications: 5 | email: true 6 | 7 | # Git仓库克隆commit深度: 8 | git: 9 | depth: 3 10 | 11 | # 运行编译构建编译脚本之前动作: 12 | before_script: 13 | # 更新32位gcc工具链 14 | - sudo apt-get update 15 | - "sudo apt-get -qq install gcc-multilib libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386 libsdl-dev || true" 16 | - "[ $RTT_TOOL_CHAIN = 'sourcery-arm' ] && curl -s https://launchpadlibrarian.net/287101520/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 | sudo tar xjf - -C /opt && export RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-5_4-2016q3/bin && /opt/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-gcc --version || true" 17 | 18 | # 克隆RT-Thread仓库 19 | - git clone --depth=3 --branch=master https://github.com/RT-Thread/rt-thread.git ../RT-Thread 20 | 21 | # 创建packages目录, 拷贝LittlevGL2RTT源码到bsp pkg下, 并拷贝对应SConscript脚本 22 | - mkdir /home/travis/build/liu2guang/RT-Thread/bsp/imxrt1052-evk/packages 23 | - cp /home/travis/build/liu2guang/LittlevGL2RTT/tools/rtconfig.h /home/travis/build/liu2guang/RT-Thread/bsp/imxrt1052-evk/rtconfig.h 24 | - cp /home/travis/build/liu2guang/LittlevGL2RTT/tools/pkg_scons /home/travis/build/liu2guang/RT-Thread/bsp/imxrt1052-evk/packages/SConscript 25 | - cp -r /home/travis/build/liu2guang/LittlevGL2RTT /home/travis/build/liu2guang/RT-Thread/bsp/imxrt1052-evk/packages/LittlevGL2RTT 26 | 27 | # 导出RT-Thread运行bsp根目录和编译器 28 | - export RTT_ROOT=`/home/travis/build/liu2guang/RT-Thread` 29 | - "[ x$RTT_CC == x ] && export RTT_CC='gcc' || true" 30 | 31 | # 运行scons构建编译项目 32 | script: 33 | - scons -C /home/travis/build/liu2guang/RT-Thread/bsp/imxrt1052-evk/ 34 | 35 | # 指定编译dwin的bsp环境 36 | env: 37 | - RTT_BSP='imxrt1052-evk' RTT_TOOL_CHAIN='sourcery-arm' 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | LittlevGL2RTT: 2 | 3 | The LittlevGL2RTT library is suitable for RT_Thread 3.0. The middle layer code belongs to liu2guang. 4 | LittlevGL source copyright is owned by the author. 5 | Thank you Gabor Kiss- Vamosi for the code. 6 | 7 | MIT License 8 | 9 | Copyright (c) 2018 liuguang 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 27 | SOFTWARE. 28 | 29 | LittlevGL: 30 | 31 | MIT licence 32 | Copyright (c) 2016 Gábor Kiss-Vámosi 33 | 34 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 35 | 36 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 37 | 38 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LittlevGL2RTT # 2 | 3 | [![Build Status](https://travis-ci.org/liu2guang/LittlevGL2RTT.svg?branch=master)](https://travis-ci.org/liu2guang/LittlevGL2RTT) 4 | [![release](https://img.shields.io/badge/Release-v0.0.1-orange.svg)](https://github.com/liu2guang/LittlevGL2RTT/releases) 5 | 6 | LittlevGL2RTT 是在RTThread3.0版本以上做的LittlevGL中间框架层, 目的是无缝嵌入RTT的LCD框架, 无需开发者去移植. 如果您觉得该库看得顺眼舒服,请捐赠颗小星星. 小星星就是更新的动力!!! 7 | 8 | 感谢LittlevGL作者的开源GUI库. 原库请移步到 [https://github.com/littlevgl/lvgl](https://github.com/littlevgl/lvgl "lvgl"). 9 | 10 | ---- 11 | ![littlevgl2rtt交流群群二维码](https://i.imgur.com/COnvJ4A.png) 12 | ---- 13 | 14 | ## 1. 效果图 15 | 16 | ![效果图](https://i.imgur.com/hdq3RhV.gif) 17 | 18 | ## 2. 安装LittlevGL2RTT 19 | 20 | 目前littlevgl2rtt库已经添加到rtt官方pkgs包中, 可以直接在menuconfig在线包中直接使能. 21 | 22 | 1. 在env中运行menuconfig. 23 | 2. 进入RT-Thread online packages -> system packages目录. 24 | 3. 开启LittlevGL2RTT, 选择version为lateset最新版本, 配置分辨率为你的显示屏分辨率, 然后开启demo并保存退出menuconfig. 25 | 4. 执行pkgs --update更新LittlevGL2RTT包到你的bsp下面. 26 | 5. 执行scons/scons --target=xxx, 进行编译生成工程, 下载运行. 27 | 28 | ![安装流程](https://i.imgur.com/fojc8Ie.gif) 29 | 30 | ## 3. 卸载LittlevGL2RTT 31 | 32 | 1. 在env中运行menuconfig. 33 | 2. 进入RT-Thread online packages -> system packages目录. 34 | 3. 关闭LittlevGL2RTT. 35 | 4. 执行pkgs --update, 并输入`Y`表示同意删除pkg包文件. 36 | 5. 执行scons/scons --target=xxx, 进行编译生成工程, 下载运行. 37 | 38 | ![卸载流程](https://i.imgur.com/yAeXejV.gif) 39 | 40 | ## 4. 注意事项 41 | 42 | 因为LittlevGL使用了匿名结构体, 所以需要在MDK中需要添加编译参数: **--gnu -g -W**. 43 | 44 | ## 5. 开发进度 45 | 46 | 1. 开发环境主要是RT1050 fire的板子(lcd为800*480, 输入设备为GT911), 和qemu环境(800*480, 输入设备为鼠标). 47 | 2. 输入接口已经完成适配,目前在野火1050板子上测试通过, 效果稳定[update]. 48 | 3. 目前只测试过16bit模式. 49 | 4. 关于更多的lvgl的配置导出到menuconfig欢迎在issues里面提出. 50 | -------------------------------------------------------------------------------- /SConscript: -------------------------------------------------------------------------------- 1 | import os 2 | from building import * 3 | 4 | # get current dir path 5 | cwd = GetCurrentDir() 6 | 7 | # init src and inc vars 8 | src = [] 9 | inc = [] 10 | 11 | # add LittlevGL2RTT common include 12 | inc = inc + [cwd] 13 | 14 | # add LittlevGL2RTT basic code 15 | src = src + ['./littlevgl2rtt.c'] 16 | 17 | # add group to IDE project 18 | objs = DefineGroup('LittlevGL2RTT', src, depend = ['PKG_USING_LITTLEVGL2RTT'], CPPPATH = inc) 19 | list = os.listdir(cwd) 20 | 21 | if GetDepend('PKG_USING_LITTLEVGL2RTT'): 22 | for d in list: 23 | path = os.path.join(cwd, d) 24 | if os.path.isfile(os.path.join(path, 'SConscript')): 25 | objs = objs + SConscript(os.path.join(d, 'SConscript')) 26 | 27 | Return('objs') 28 | -------------------------------------------------------------------------------- /example/SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | import rtconfig 3 | 4 | # get current dir path 5 | cwd = GetCurrentDir() 6 | 7 | # init src and inc vars 8 | src = [] 9 | inc = [] 10 | 11 | # add LittlevGL2RTT common include 12 | inc = inc + [cwd] 13 | 14 | # add LittlevGL2RTT basic code 15 | src = Glob('*.c') 16 | 17 | LOCAL_CCFLAGS = '' 18 | 19 | if rtconfig.CROSS_TOOL == 'gcc': 20 | LOCAL_CCFLAGS += ' -std=c99' 21 | elif rtconfig.CROSS_TOOL == 'keil': 22 | LOCAL_CCFLAGS += ' --c99 --gnu -g -W' 23 | 24 | group = DefineGroup('LittlevGL2RTT_Demo', src, depend = ['LITTLEVGL2RTT_USING_DEMO'], CPPPATH = inc, LOCAL_CCFLAGS = LOCAL_CCFLAGS) 25 | 26 | Return('group') 27 | -------------------------------------------------------------------------------- /example/littlevgl2rtt_demo.c: -------------------------------------------------------------------------------- 1 | #include "littlevgl2rtt.h" 2 | #include "lvgl.h" 3 | 4 | #include 5 | #include 6 | 7 | #include "lv_test_theme.h" 8 | 9 | static void lvgl_demo_run(void *p) 10 | { 11 | lv_demo_widgets(); 12 | 13 | 14 | } 15 | 16 | int rt_lvgl_demo_init(void) 17 | { 18 | rt_err_t ret = RT_EOK; 19 | rt_thread_t thread = RT_NULL; 20 | 21 | /* init littlevGL */ 22 | ret = littlevgl2rtt_init("lcd"); 23 | if(ret != RT_EOK) 24 | { 25 | return ret; 26 | } 27 | 28 | /* littleGL demo gui thread */ 29 | thread = rt_thread_create("lv_demo", lvgl_demo_run, RT_NULL, 10*1024, 5, 10); 30 | if(thread == RT_NULL) 31 | { 32 | return RT_ERROR; 33 | } 34 | rt_thread_startup(thread); 35 | 36 | return RT_EOK; 37 | } 38 | INIT_APP_EXPORT(rt_lvgl_demo_init); 39 | -------------------------------------------------------------------------------- /example/lv_test_theme.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_test_theme.h 3 | * 4 | */ 5 | 6 | #ifndef LV_TEST_THEME_H 7 | #define LV_TEST_THEME_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lvgl/lvgl.h" 17 | 18 | /********************* 19 | * DEFINES 20 | *********************/ 21 | 22 | /********************** 23 | * TYPEDEFS 24 | **********************/ 25 | 26 | /********************** 27 | * GLOBAL PROTOTYPES 28 | **********************/ 29 | 30 | /** 31 | * Create a test screen with a lot objects and apply the given theme on them 32 | * @param th pointer to a theme 33 | */ 34 | void lv_demo_widgets(); 35 | 36 | /********************** 37 | * MACROS 38 | **********************/ 39 | 40 | #ifdef __cplusplus 41 | } /* extern "C" */ 42 | #endif 43 | 44 | #endif /*LV_TEST_THEME_H*/ 45 | -------------------------------------------------------------------------------- /littlevgl2rtt.h: -------------------------------------------------------------------------------- 1 | #ifndef __LITTLEVGL2RTT_H__ 2 | #define __LITTLEVGL2RTT_H__ 3 | 4 | #include 5 | #include 6 | 7 | enum littlevgl2rtt_input_state 8 | { 9 | LITTLEVGL2RTT_INPUT_NONE = 0x00, 10 | LITTLEVGL2RTT_INPUT_UP = 0x01, 11 | LITTLEVGL2RTT_INPUT_DOWN = 0x02, 12 | LITTLEVGL2RTT_INPUT_MOVE = 0x03 13 | }; 14 | 15 | rt_err_t littlevgl2rtt_init(const char *name); 16 | void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state); 17 | void littlevgl2rtt_deinit(void); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /lvgl.h: -------------------------------------------------------------------------------- 1 | #include "./lvgl/lvgl.h" 2 | -------------------------------------------------------------------------------- /lvgl/.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 21 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - architecture 8 | - pinned 9 | # Label to use when marking an issue as stale 10 | # staleLabel: 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue or pull request has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions. 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false 18 | -------------------------------------------------------------------------------- /lvgl/.gitignore: -------------------------------------------------------------------------------- 1 | **/*.o -------------------------------------------------------------------------------- /lvgl/README.md: -------------------------------------------------------------------------------- 1 | # Littlev Graphics Library 2 | 3 | ![LittlevGL cover](https://littlevgl.com/docs/themes/lv_theme_intro.png) 4 | 5 | **LittlevGL provides everything you need to create a Graphical User Interface (GUI) on embedded systems with easy-to-use graphical elements, beautiful visual effects and low memory footprint.** 6 | https://littlevgl.com 7 | 8 | Check out the [References](https://blog.littlevgl.com/2018-12-26/references) where LittlevGL was used. You can add your project too! 9 | 10 | ## Key features 11 | * **Powerful building blocks** buttons, charts, lists, sliders, images, etc. 12 | * **Advanced graphics** with animations, anti-aliasing, opacity, smooth scrolling 13 | * **Various input devices** touch pad, mouse, keyboard, encoder, buttons, etc. 14 | * **Multi-language support** with UTF-8 encoding 15 | * **Fully customizable** graphical elements 16 | * **Hardware independent** to use with any microcontroller or display 17 | * **Scalable** to operate with little memory (50 kB Flash, 10 kB RAM) 18 | * **OS, External memory and GPU** supported but not required 19 | * **Single frame buffer** operation even with advances graphical effects 20 | * **Written in C** for maximal compatibility 21 | * **Simulator** to develop on PC without embedded hardware 22 | * **Tutorials, examples, themes** for rapid development 23 | * **Documentation** and API references online 24 | 25 | ## Porting 26 | In the simplest case you need 5 things: 27 | 1. Call `lv_tick_inc(x)` every `x` milliseconds in a Timer or Task (`x` should be between 1 and 10) 28 | 2. Register a function which can **copy a pixel array** to an area of the screen. 29 | 3. Register a function which can **read an input device**. (E.g. touch pad) 30 | 4. Copy `lv_conf_templ.h` as `lv_conf.h` and set at least `LV_HOR_RES`, `LV_VER_RES` and `LV_COLOR_DEPTH`. 31 | 5. Call `lv_task_handler()` periodically every few milliseconds. 32 | For a detailed description visit https://github.com/littlevgl/lvgl/wiki/Porting 33 | Or check the [Porting tutorial](https://github.com/littlevgl/lv_examples/blob/master/lv_tutorial/0_porting/lv_tutorial_porting.c) 34 | 35 | ## Project set-up 36 | 1. **Clone** or [Download](https://littlevgl.com/download) the lvgl repository: `git clone https://github.com/littlevgl/lvgl.git` 37 | 2. **Create project** with your preferred IDE and add the *lvgl* folder 38 | 3. Copy **lvgl/lv_conf_templ.h** as **lv_conf.h** next to the *lvgl* folder 39 | 4. In the lv_conf.h delete the first `#if 0` and its `#endif`. Leave the default configuration for the first try. 40 | 5. In your *main.c*: #include "lvgl/lvgl.h" 41 | 6. In your *main function*: 42 | * lvgl_init(); 43 | * tick, display and input device initialization (see above) 44 | 7. To **test** create a label: `lv_obj_t * label = lv_label_create(lv_scr_act(), NULL);` 45 | 8. In the main *while(1)* call `lv_task_handler();` and make a few milliseconds delay (e.g. `my_delay_ms(5);`) 46 | 9. Compile the code and load it to your embedded hardware 47 | 48 | ## PC Simulator 49 | You can test the graphics library in a PC simulator, if you don't have an embedded hardware. The simulator uses [SDL2](https://www.libsdl.org/) library to emulate a display on your monitor and a touch pad with your mouse. 50 | 51 | There is a pre-configured PC project for **Eclipse CDT** in this repository: https://github.com/littlevgl/pc_simulator 52 | 53 | ## Related repositories 54 | * PC simulator: https://github.com/littlevgl/pc_simulator 55 | * Projects: https://github.com/littlevgl/lv_projects 56 | * Examples: https://github.com/littlevgl/lv_examples 57 | * Drivers: https://github.com/littlevgl/lv_drivers 58 | 59 | ## Screenshots 60 | ![TFT material](http://www.gl.littlev.hu/github_res/tft_material.png) 61 | ![TFT zen](http://www.gl.littlev.hu/github_res/tft_zen.png) 62 | ![TFT alien](http://www.gl.littlev.hu/github_res/tft_alien.png) 63 | ![TFT night](http://www.gl.littlev.hu/github_res/tft_night.png) 64 | 65 | ## Contributing 66 | See [CONTRIBUTING.md](https://github.com/littlevgl/lvgl/blob/master/docs/CONTRIBUTING.md) 67 | 68 | ## Donate 69 | If you are pleased with this graphics library, found it useful, or are happy with the support you got, please help its further development: 70 | 71 | [![Donate](https://littlevgl.com/donate_dir/donate_btn.png)](https://littlevgl.com/donate) 72 | -------------------------------------------------------------------------------- /lvgl/SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | import rtconfig 3 | 4 | # get current dir path 5 | cwd = GetCurrentDir() 6 | 7 | # init src and inc vars 8 | src = [] 9 | inc = [] 10 | 11 | # add LittlevGL common include 12 | inc = inc + [cwd] 13 | inc = inc + [cwd + "/lv_core"] 14 | inc = inc + [cwd + "/lv_draw"] 15 | inc = inc + [cwd + "/lv_hal"] 16 | inc = inc + [cwd + "/lv_misc"] 17 | inc = inc + [cwd + "/lv_font"] 18 | inc = inc + [cwd + "/lv_widgets"] 19 | inc = inc + [cwd + "/lv_themes"] 20 | 21 | # add LittlevGL basic code 22 | src = src + Glob('./lv_core/*.c') 23 | src = src + Glob('./lv_draw/*.c') 24 | src = src + Glob('./lv_hal/*.c') 25 | src = src + Glob('./lv_misc/*.c') 26 | src = src + Glob('./lv_font/*.c') 27 | src = src + Glob('./lv_widgets/*.c') 28 | src = src + Glob('./lv_themes/*.c') 29 | 30 | LOCAL_CCFLAGS = '' 31 | 32 | if rtconfig.CROSS_TOOL == 'gcc': 33 | LOCAL_CCFLAGS += ' -std=c99' 34 | elif rtconfig.CROSS_TOOL == 'keil': 35 | LOCAL_CCFLAGS += ' --c99 --gnu -g -W' 36 | 37 | group = DefineGroup('LittlevGL2RTT', src, depend = ['PKG_USING_LITTLEVGL2RTT'], CPPPATH = inc, LOCAL_CCFLAGS = LOCAL_CCFLAGS) 38 | 39 | Return('group') 40 | -------------------------------------------------------------------------------- /lvgl/docs/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [atom@github.com](mailto:atom@github.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /lvgl/docs/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Littlev Graphics Library 2 | 3 | **Welcome! It's glad to see that you are interested in contributing to LittlevGL! There are several types of task where you can help to build a better library! Let's see how to get started!** 4 | 5 | 6 | There are many different possibilities to join the community. If you have some time to work with us I'm sure you will find something that fits you! You can: 7 | - answer other's questions 8 | - report and/or fix bugs 9 | - suggest and/or implement new features 10 | - improve and/or translate the documentation 11 | - write a blog post about your experiences 12 | 13 | But first, start with the most Frequently Asked Questions. 14 | 15 | ## FAQ about contributing 16 | 17 | ### Where can I write my question and remarks? 18 | 19 | We use [GitHub's issue tracker](https://github.com/littlevgl/lvgl/issues) to ask questions., report bugs and suggest features. But there are some simple rules: 20 | - Be kind and friendly. 21 | - Speak about one thing in one issue. 22 | - Give feedback and close the issue if your question is answered. 23 | - Tell what you experience or expect. _"The button is not working"_ is not enough info to get help. 24 | - If possible send an absolute minimal code example in order to reproduce the issue 25 | - Use [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) to format your post. 26 | - If you don't get any answer in a week write a comment like "Can somebody help?". Maybe your issue wasn't noticed. 27 | 28 | ### How can I send fixes and improvements? 29 | Merging new code happens via Pull Requests. If you are still not familiar with the Pull Requests (PR for short) here is a quick guide about them: 30 | 1. **Fork** the [lvgl repository](https://github.com/littlevgl/lvgl). To do this click the "Fork" button in the top right corner. It will "copy" the `lvgl` repository to your GitHub account (`https://github.com/your_name?tab=repositories`) 31 | 2. **Clone** the forked repository and add your updates 32 | 3. **Create a PR** on the GitHub on the page of you `lvgl` repository(`https://github.com/your_name/lvgl`) by hitting the "New pull request" button 33 | 4. **Set the base branch**. It means where you want to merge your update. Fixes go to `master`, new features to the actual `dev-x.y` branch. 34 | 5. **Describe** what is in the update. An example code is welcome if applicable. 35 | 36 | Some advice: 37 | - If you are not sure about your fix or feature it's better to open an issue first, and discuss the details there. 38 | - Maybe your fix or update won't be perfect at first. Don't be afraid, just improve it and push the new commits. The PR will be updated accordingly. 39 | - If your update needs some extra work it's okay to say: _"I'm busy now and I will improve it soon"_ or _"Sorry, I don't have time to improve it, I hope it helps in this form too"_. So it's better to say don't have time to continue then saying nothing. 40 | - Please read and follow this [guide about the coding style](https://docs.littlevgl.com/#Coding-Style-Guide) 41 | 42 | 43 | ### Where is the documentation? 44 | 45 | You can read the documentation here: https://docs.littlevgl.com/ 46 | You can edit the documentation here: https://github.com/littlevgl/doc 47 | 48 | ### Where is the blog? 49 | 50 | You can read the blog here: https://blog.littlevgl.com/ 51 | You can edit the blog here: https://github.com/littlevgl/blog 52 | 53 | 54 | ## So how and where can I contribute? 55 | 56 | ### Answering other's questions 57 | 58 | It's a great way to contribute to the library if you already use it. Just go the [issue tracker](https://github.com/littlevgl/lvgl/issues), read the titles and if you are already familiar with a topic, don't be shy, and write your suggestion. 59 | 60 | ### Reporting and/or fixing bugs 61 | For simple bugfixes (typos, missing error handling, fixing a warning) is fine to send a Pull request directly. However, for more complex bugs it's better to open an issue first. In the issue, you should describe how to reproduce the bug and even add the minimal code snippet. 62 | 63 | ### Suggesting and/or implementing new features 64 | If you have a good idea don't hesitate to share with us. It's even better if you have time to deal with its implementation. Don't be afraid if you still don't know LittlevGL well enough. We will help you to get started. 65 | 66 | During the implementation don't forget the [Code style guide](https://docs.littlevgl.com/#Coding-Style-Guide). 67 | 68 | ### Improving and/or translating the documentation 69 | 70 | The documentation of LittlevGL is written in Markdown and available [here](https://github.com/littlevgl/doc) for editing. If you find some parts of the documentation obscure or insufficient just search the related `.md` file, hit the edit icon and add your updates. This way a new Pull request will be generated automatically. 71 | 72 | If you can devote more time to improve the documentation you can translate it! 73 | 1. Just copy the English `.md` files from the root folder to `locale/LANGUAGE_CODE` (language code is e.g. DE, FR, ES etc) 74 | 2. Append the language code the end of files (e.g. Welcome_fr.md) 75 | 3. Update the filenames in `_Sidebar.md` 76 | 4. Translate the page(s) you want 77 | 5. Create a Pull request 78 | 79 | ### Writing a blog post about your experiences 80 | 81 | Have ported LittlevGL to a new platform? Have you created a fancy GUI? Do you know a great trick? 82 | You can share your knowledge on LittelvGL's blog! It's super easy to add your own post: 83 | - Fork and clone the [blog repository](https://github.com/littlevgl/blog) 84 | - Add your post in Markdown to the `_posts` folder. 85 | - Store the images and other resources in a dedicated folder in `assets` 86 | - Create a Pull Request 87 | 88 | The blog uses [Jekyll](https://jekyllrb.com/) to convert the `.md` files to a webpage. You can easily [run Jekyll offline](https://jekyllrb.com/docs/) to check your post before creating the Pull request 89 | 90 | ## Summary 91 | 92 | I hope you have taken a liking to contribute to LittelvGL. A helpful and friendly community is waiting for you! :) 93 | 94 | -------------------------------------------------------------------------------- /lvgl/docs/astyle_c: -------------------------------------------------------------------------------- 1 | --style=kr --convert-tabs --indent=spaces=4 --indent-switches --pad-oper --unpad-paren --align-pointer=middle --suffix=.bak --lineend=linux --min-conditional-indent= 2 | -------------------------------------------------------------------------------- /lvgl/docs/astyle_h: -------------------------------------------------------------------------------- 1 | --convert-tabs --indent=spaces=4 2 | -------------------------------------------------------------------------------- /lvgl/licence.txt: -------------------------------------------------------------------------------- 1 | MIT licence 2 | Copyright (c) 2016 Gábor Kiss-Vámosi 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | -------------------------------------------------------------------------------- /lvgl/lv_core/lv_core.mk: -------------------------------------------------------------------------------- 1 | CSRCS += lv_group.c 2 | CSRCS += lv_indev.c 3 | CSRCS += lv_disp.c 4 | CSRCS += lv_obj.c 5 | CSRCS += lv_refr.c 6 | CSRCS += lv_style.c 7 | 8 | DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core 9 | VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core 10 | 11 | CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core" 12 | -------------------------------------------------------------------------------- /lvgl/lv_core/lv_refr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_refr.h 3 | * 4 | */ 5 | 6 | #ifndef LV_REFR_H 7 | #define LV_REFR_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "lv_obj.h" 17 | #include 18 | 19 | /********************* 20 | * DEFINES 21 | *********************/ 22 | 23 | #define LV_REFR_TASK_PRIO LV_TASK_PRIO_MID 24 | 25 | /********************** 26 | * TYPEDEFS 27 | **********************/ 28 | 29 | /********************** 30 | * STATIC PROTOTYPES 31 | **********************/ 32 | 33 | /********************** 34 | * STATIC VARIABLES 35 | **********************/ 36 | 37 | /********************** 38 | * MACROS 39 | **********************/ 40 | 41 | /********************** 42 | * GLOBAL FUNCTIONS 43 | **********************/ 44 | 45 | /** 46 | * Initialize the screen refresh subsystem 47 | */ 48 | void _lv_refr_init(void); 49 | 50 | /** 51 | * Redraw the invalidated areas now. 52 | * Normally the redrawing is periodically executed in `lv_task_handler` but a long blocking process 53 | * can prevent the call of `lv_task_handler`. In this case if the the GUI is updated in the process 54 | * (e.g. progress bar) this function can be called when the screen should be updated. 55 | * @param disp pointer to display to refresh. NULL to refresh all displays. 56 | */ 57 | void lv_refr_now(lv_disp_t * disp); 58 | 59 | /** 60 | * Invalidate an area on display to redraw it 61 | * @param area_p pointer to area which should be invalidated (NULL: delete the invalidated areas) 62 | * @param disp pointer to display where the area should be invalidated (NULL can be used if there is 63 | * only one display) 64 | */ 65 | void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p); 66 | 67 | /** 68 | * Get the display which is being refreshed 69 | * @return the display being refreshed 70 | */ 71 | lv_disp_t * _lv_refr_get_disp_refreshing(void); 72 | 73 | /** 74 | * Set the display which is being refreshed. 75 | * It shouldn't be used directly by the user. 76 | * It can be used to trick the drawing functions about there is an active display. 77 | * @param the display being refreshed 78 | */ 79 | void _lv_refr_set_disp_refreshing(lv_disp_t * disp); 80 | 81 | /** 82 | * Called periodically to handle the refreshing 83 | * @param task pointer to the task itself 84 | */ 85 | void _lv_disp_refr_task(lv_task_t * task); 86 | 87 | /********************** 88 | * STATIC FUNCTIONS 89 | **********************/ 90 | 91 | #ifdef __cplusplus 92 | } /* extern "C" */ 93 | #endif 94 | 95 | #endif /*LV_REFR_H*/ 96 | -------------------------------------------------------------------------------- /lvgl/lv_draw/lv_draw.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_draw.h 3 | * 4 | */ 5 | 6 | #ifndef LV_DRAW_H 7 | #define LV_DRAW_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #include "../lv_core/lv_style.h" 19 | #include "../lv_misc/lv_txt.h" 20 | #include "lv_img_decoder.h" 21 | 22 | #include "lv_draw_rect.h" 23 | #include "lv_draw_label.h" 24 | #include "lv_draw_img.h" 25 | #include "lv_draw_line.h" 26 | #include "lv_draw_triangle.h" 27 | #include "lv_draw_arc.h" 28 | #include "lv_draw_blend.h" 29 | #include "lv_draw_mask.h" 30 | 31 | /********************* 32 | * DEFINES 33 | *********************/ 34 | 35 | /********************** 36 | * TYPEDEFS 37 | **********************/ 38 | 39 | /********************** 40 | * GLOBAL PROTOTYPES 41 | **********************/ 42 | 43 | /********************** 44 | * GLOBAL VARIABLES 45 | **********************/ 46 | 47 | /********************** 48 | * MACROS 49 | **********************/ 50 | 51 | /********************** 52 | * POST INCLUDES 53 | *********************/ 54 | 55 | #ifdef __cplusplus 56 | } /* extern "C" */ 57 | #endif 58 | 59 | #endif /*LV_DRAW_H*/ 60 | -------------------------------------------------------------------------------- /lvgl/lv_draw/lv_draw.mk: -------------------------------------------------------------------------------- 1 | CSRCS += lv_draw_mask.c 2 | CSRCS += lv_draw_blend.c 3 | CSRCS += lv_draw_rect.c 4 | CSRCS += lv_draw_label.c 5 | CSRCS += lv_draw_line.c 6 | CSRCS += lv_draw_img.c 7 | CSRCS += lv_draw_arc.c 8 | CSRCS += lv_draw_triangle.c 9 | CSRCS += lv_img_decoder.c 10 | CSRCS += lv_img_cache.c 11 | CSRCS += lv_img_buf.c 12 | 13 | DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_draw 14 | VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_draw 15 | 16 | CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_draw" 17 | -------------------------------------------------------------------------------- /lvgl/lv_draw/lv_draw_arc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_draw_arc.h 3 | * 4 | */ 5 | 6 | #ifndef LV_DRAW_ARC_H 7 | #define LV_DRAW_ARC_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "lv_draw_line.h" 17 | 18 | /********************* 19 | * DEFINES 20 | *********************/ 21 | 22 | /********************** 23 | * TYPEDEFS 24 | **********************/ 25 | 26 | /********************** 27 | * GLOBAL PROTOTYPES 28 | **********************/ 29 | 30 | /** 31 | * Draw an arc. (Can draw pie too with great thickness.) 32 | * @param center_x the x coordinate of the center of the arc 33 | * @param center_y the y coordinate of the center of the arc 34 | * @param radius the radius of the arc 35 | * @param mask the arc will be drawn only in this mask 36 | * @param start_angle the start angle of the arc (0 deg on the bottom, 90 deg on the right) 37 | * @param end_angle the end angle of the arc 38 | * @param clip_area the arc will be drawn only in this area 39 | * @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable 40 | */ 41 | void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uint16_t start_angle, uint16_t end_angle, 42 | const lv_area_t * clip_area, const lv_draw_line_dsc_t * dsc); 43 | 44 | /********************** 45 | * MACROS 46 | **********************/ 47 | 48 | #ifdef __cplusplus 49 | } /* extern "C" */ 50 | #endif 51 | 52 | #endif /*LV_DRAW_ARC*/ 53 | -------------------------------------------------------------------------------- /lvgl/lv_draw/lv_draw_blend.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_draw_blend.h 3 | * 4 | */ 5 | 6 | #ifndef LV_DRAW_BLEND_H 7 | #define LV_DRAW_BLEND_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_misc/lv_color.h" 17 | #include "../lv_misc/lv_area.h" 18 | #include "lv_draw_mask.h" 19 | 20 | /********************* 21 | * DEFINES 22 | *********************/ 23 | 24 | /********************** 25 | * TYPEDEFS 26 | **********************/ 27 | enum { 28 | LV_BLEND_MODE_NORMAL, 29 | #if LV_USE_BLEND_MODES 30 | LV_BLEND_MODE_ADDITIVE, 31 | LV_BLEND_MODE_SUBTRACTIVE, 32 | #endif 33 | }; 34 | 35 | typedef uint8_t lv_blend_mode_t; 36 | 37 | /********************** 38 | * GLOBAL PROTOTYPES 39 | **********************/ 40 | 41 | //! @cond Doxygen_Suppress 42 | LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area, lv_color_t color, 43 | lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode); 44 | 45 | 46 | LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area, 47 | const lv_color_t * map_buf, 48 | lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode); 49 | 50 | //! @endcond 51 | /********************** 52 | * MACROS 53 | **********************/ 54 | 55 | #ifdef __cplusplus 56 | } /* extern "C" */ 57 | #endif 58 | 59 | #endif /*LV_DRAW_BLEND_H*/ 60 | -------------------------------------------------------------------------------- /lvgl/lv_draw/lv_draw_img.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_draw_img.h 3 | * 4 | */ 5 | 6 | #ifndef LV_DRAW_IMG_H 7 | #define LV_DRAW_IMG_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "lv_img_decoder.h" 17 | #include "lv_img_buf.h" 18 | 19 | /********************* 20 | * DEFINES 21 | *********************/ 22 | 23 | /********************** 24 | * MACROS 25 | **********************/ 26 | 27 | /********************** 28 | * TYPEDEFS 29 | **********************/ 30 | 31 | typedef struct { 32 | lv_opa_t opa; 33 | 34 | uint16_t angle; 35 | lv_point_t pivot; 36 | uint16_t zoom; 37 | 38 | lv_opa_t recolor_opa; 39 | lv_color_t recolor; 40 | 41 | lv_blend_mode_t blend_mode; 42 | 43 | uint8_t antialias : 1; 44 | } lv_draw_img_dsc_t; 45 | 46 | /********************** 47 | * GLOBAL PROTOTYPES 48 | **********************/ 49 | 50 | void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc); 51 | /** 52 | * Draw an image 53 | * @param coords the coordinates of the image 54 | * @param mask the image will be drawn only in this area 55 | * @param src pointer to a lv_color_t array which contains the pixels of the image 56 | * @param dsc pointer to an initialized `lv_draw_img_dsc_t` variable 57 | */ 58 | void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, const lv_draw_img_dsc_t * dsc); 59 | 60 | /** 61 | * Get the type of an image source 62 | * @param src pointer to an image source: 63 | * - pointer to an 'lv_img_t' variable (image stored internally and compiled into the code) 64 | * - a path to a file (e.g. "S:/folder/image.bin") 65 | * - or a symbol (e.g. LV_SYMBOL_CLOSE) 66 | * @return type of the image source LV_IMG_SRC_VARIABLE/FILE/SYMBOL/UNKNOWN 67 | */ 68 | lv_img_src_t lv_img_src_get_type(const void * src); 69 | 70 | /** 71 | * Get the pixel size of a color format in bits 72 | * @param cf a color format (`LV_IMG_CF_...`) 73 | * @return the pixel size in bits 74 | */ 75 | uint8_t lv_img_cf_get_px_size(lv_img_cf_t cf); 76 | 77 | /** 78 | * Check if a color format is chroma keyed or not 79 | * @param cf a color format (`LV_IMG_CF_...`) 80 | * @return true: chroma keyed; false: not chroma keyed 81 | */ 82 | bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf); 83 | 84 | /** 85 | * Check if a color format has alpha channel or not 86 | * @param cf a color format (`LV_IMG_CF_...`) 87 | * @return true: has alpha channel; false: doesn't have alpha channel 88 | */ 89 | bool lv_img_cf_has_alpha(lv_img_cf_t cf); 90 | 91 | 92 | #ifdef __cplusplus 93 | } /* extern "C" */ 94 | #endif 95 | 96 | #endif /*LV_TEMPL_H*/ 97 | -------------------------------------------------------------------------------- /lvgl/lv_draw/lv_draw_label.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_draw_label.h 3 | * 4 | */ 5 | 6 | #ifndef LV_DRAW_LABEL_H 7 | #define LV_DRAW_LABEL_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_misc/lv_bidi.h" 17 | #include "../lv_misc/lv_txt.h" 18 | #include "../lv_core/lv_style.h" 19 | 20 | /********************* 21 | * DEFINES 22 | *********************/ 23 | #define LV_DRAW_LABEL_NO_TXT_SEL (0xFFFF) 24 | 25 | /********************** 26 | * TYPEDEFS 27 | **********************/ 28 | 29 | typedef struct { 30 | lv_color_t color; 31 | lv_color_t sel_color; 32 | lv_color_t sel_bg_color; 33 | const lv_font_t * font; 34 | lv_opa_t opa; 35 | lv_style_int_t line_space; 36 | lv_style_int_t letter_space; 37 | uint32_t sel_start; 38 | uint32_t sel_end; 39 | lv_coord_t ofs_x; 40 | lv_coord_t ofs_y; 41 | lv_bidi_dir_t bidi_dir; 42 | lv_txt_flag_t flag; 43 | lv_text_decor_t decor; 44 | lv_blend_mode_t blend_mode; 45 | } lv_draw_label_dsc_t; 46 | 47 | /** Store some info to speed up drawing of very large texts 48 | * It takes a lot of time to get the first visible character because 49 | * all the previous characters needs to be checked to calculate the positions. 50 | * This structure stores an earlier (e.g. at -1000 px) coordinate and the index of that line. 51 | * Therefore the calculations can start from here.*/ 52 | typedef struct { 53 | /** Index of the line at `y` coordinate*/ 54 | int32_t line_start; 55 | 56 | /** Give the `y` coordinate of the first letter at `line start` index. Relative to the label's coordinates*/ 57 | int32_t y; 58 | 59 | /** The 'y1' coordinate of the label when the hint was saved. 60 | * Used to invalidate the hint if the label has moved too much. */ 61 | int32_t coord_y; 62 | } lv_draw_label_hint_t; 63 | 64 | /********************** 65 | * GLOBAL PROTOTYPES 66 | **********************/ 67 | 68 | //! @cond Doxygen_Suppress 69 | 70 | LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc); 71 | 72 | /** 73 | * Write a text 74 | * @param coords coordinates of the label 75 | * @param mask the label will be drawn only in this area 76 | * @param dsc pointer to draw descriptor 77 | * @param txt `\0` terminated text to write 78 | * @param hint pointer to a `lv_draw_label_hint_t` variable. 79 | * It is managed by the drawer to speed up the drawing of very long texts (thousands of lines). 80 | */ 81 | LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, 82 | const lv_draw_label_dsc_t * dsc, 83 | const char * txt, lv_draw_label_hint_t * hint); 84 | 85 | //! @endcond 86 | /*********************** 87 | * GLOBAL VARIABLES 88 | ***********************/ 89 | extern const uint8_t _lv_bpp2_opa_table[]; 90 | extern const uint8_t _lv_bpp3_opa_table[]; 91 | extern const uint8_t _lv_bpp1_opa_table[]; 92 | extern const uint8_t _lv_bpp4_opa_table[]; 93 | extern const uint8_t _lv_bpp8_opa_table[]; 94 | 95 | /********************** 96 | * MACROS 97 | **********************/ 98 | 99 | #ifdef __cplusplus 100 | } /* extern "C" */ 101 | #endif 102 | 103 | #endif /*LV_DRAW_LABEL_H*/ 104 | -------------------------------------------------------------------------------- /lvgl/lv_draw/lv_draw_line.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_draw_line.h 3 | * 4 | */ 5 | 6 | #ifndef LV_DRAW_LINE_H 7 | #define LV_DRAW_LINE_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_core/lv_style.h" 17 | 18 | /********************* 19 | * DEFINES 20 | *********************/ 21 | 22 | /********************** 23 | * TYPEDEFS 24 | **********************/ 25 | typedef struct { 26 | lv_color_t color; 27 | lv_style_int_t width; 28 | lv_style_int_t dash_width; 29 | lv_style_int_t dash_gap; 30 | lv_opa_t opa; 31 | lv_blend_mode_t blend_mode : 2; 32 | uint8_t round_start : 1; 33 | uint8_t round_end : 1; 34 | uint8_t raw_end : 1; /*Do not bother with perpendicular line ending is it's not visible for any reason*/ 35 | } lv_draw_line_dsc_t; 36 | 37 | /********************** 38 | * GLOBAL PROTOTYPES 39 | **********************/ 40 | 41 | //! @cond Doxygen_Suppress 42 | /** 43 | * Draw a line 44 | * @param point1 first point of the line 45 | * @param point2 second point of the line 46 | * @param clip the line will be drawn only in this area 47 | * @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable 48 | */ 49 | LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip, 50 | const lv_draw_line_dsc_t * dsc); 51 | 52 | LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc); 53 | 54 | 55 | //! @endcond 56 | 57 | /********************** 58 | * MACROS 59 | **********************/ 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /*LV_DRAW_LINE_H*/ 66 | -------------------------------------------------------------------------------- /lvgl/lv_draw/lv_draw_rect.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_draw_rect.h 3 | * 4 | */ 5 | 6 | #ifndef LV_DRAW_RECT_H 7 | #define LV_DRAW_RECT_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_core/lv_style.h" 17 | 18 | /********************* 19 | * DEFINES 20 | *********************/ 21 | 22 | /********************** 23 | * TYPEDEFS 24 | **********************/ 25 | 26 | typedef struct { 27 | lv_style_int_t radius; 28 | 29 | /*Background*/ 30 | lv_color_t bg_color; 31 | lv_color_t bg_grad_color; 32 | lv_grad_dir_t bg_grad_dir; 33 | lv_style_int_t bg_main_color_stop; 34 | lv_style_int_t bg_grad_color_stop; 35 | lv_opa_t bg_opa; 36 | lv_blend_mode_t bg_blend_mode; 37 | 38 | /*Border*/ 39 | lv_color_t border_color; 40 | lv_style_int_t border_width; 41 | lv_style_int_t border_side; 42 | lv_opa_t border_opa; 43 | lv_blend_mode_t border_blend_mode; 44 | uint8_t border_post : 1; /*There is a border it will be drawn later. */ 45 | 46 | /*Outline*/ 47 | lv_color_t outline_color; 48 | lv_style_int_t outline_width; 49 | lv_style_int_t outline_pad; 50 | lv_opa_t outline_opa; 51 | lv_blend_mode_t outline_blend_mode; 52 | 53 | /*Shadow*/ 54 | lv_color_t shadow_color; 55 | lv_style_int_t shadow_width; 56 | lv_style_int_t shadow_ofs_x; 57 | lv_style_int_t shadow_ofs_y; 58 | lv_style_int_t shadow_spread; 59 | lv_opa_t shadow_opa; 60 | lv_blend_mode_t shadow_blend_mode; 61 | 62 | /*Pattern*/ 63 | const void * pattern_image; 64 | const lv_font_t * pattern_font; 65 | lv_color_t pattern_recolor; 66 | lv_opa_t pattern_opa; 67 | lv_opa_t pattern_recolor_opa; 68 | uint8_t pattern_repeat : 1; 69 | lv_blend_mode_t pattern_blend_mode; 70 | 71 | /*Value*/ 72 | const char * value_str; 73 | const lv_font_t * value_font; 74 | lv_opa_t value_opa; 75 | lv_color_t value_color; 76 | lv_style_int_t value_ofs_x; 77 | lv_style_int_t value_ofs_y; 78 | lv_style_int_t value_letter_space; 79 | lv_style_int_t value_line_space; 80 | lv_align_t value_align; 81 | lv_blend_mode_t value_blend_mode; 82 | } lv_draw_rect_dsc_t; 83 | 84 | /********************** 85 | * GLOBAL PROTOTYPES 86 | **********************/ 87 | 88 | LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc); 89 | 90 | //! @endcond 91 | 92 | /** 93 | * Draw a rectangle 94 | * @param coords the coordinates of the rectangle 95 | * @param mask the rectangle will be drawn only in this mask 96 | * @param dsc pointer to an initialized `lv_draw_rect_dsc_t` variable 97 | */ 98 | void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_draw_rect_dsc_t * dsc); 99 | 100 | /** 101 | * Draw a pixel 102 | * @param point the coordinates of the point to draw 103 | * @param mask the pixel will be drawn only in this mask 104 | * @param style pointer to a style 105 | */ 106 | void lv_draw_px(const lv_point_t * point, const lv_area_t * clip_area, const lv_style_t * style); 107 | 108 | /********************** 109 | * MACROS 110 | **********************/ 111 | 112 | #ifdef __cplusplus 113 | } /* extern "C" */ 114 | #endif 115 | 116 | #endif /*LV_DRAW_RECT_H*/ 117 | -------------------------------------------------------------------------------- /lvgl/lv_draw/lv_draw_triangle.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_draw_triangle.c 3 | * 4 | */ 5 | 6 | /********************* 7 | * INCLUDES 8 | *********************/ 9 | #include "lv_draw_triangle.h" 10 | #include "../lv_misc/lv_math.h" 11 | #include "../lv_misc/lv_mem.h" 12 | 13 | /********************* 14 | * DEFINES 15 | *********************/ 16 | 17 | /********************** 18 | * TYPEDEFS 19 | **********************/ 20 | 21 | /********************** 22 | * STATIC PROTOTYPES 23 | **********************/ 24 | 25 | /********************** 26 | * STATIC VARIABLES 27 | **********************/ 28 | 29 | /********************** 30 | * MACROS 31 | **********************/ 32 | 33 | /********************** 34 | * GLOBAL FUNCTIONS 35 | **********************/ 36 | 37 | /** 38 | * Draw a triangle 39 | * @param points pointer to an array with 3 points 40 | * @param clip_area the triangle will be drawn only in this area 41 | * @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable 42 | */ 43 | void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip_area, const lv_draw_rect_dsc_t * draw_dsc) 44 | { 45 | lv_draw_polygon(points, 3, clip_area, draw_dsc); 46 | } 47 | 48 | /** 49 | * Draw a polygon. Only convex polygons are supported 50 | * @param points an array of points 51 | * @param point_cnt number of points 52 | * @param clip_area polygon will be drawn only in this area 53 | * @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable 54 | */ 55 | void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * clip_area, 56 | const lv_draw_rect_dsc_t * draw_dsc) 57 | { 58 | if(point_cnt < 3) return; 59 | if(points == NULL) return; 60 | 61 | int16_t i; 62 | lv_area_t poly_coords = {.x1 = LV_COORD_MAX, .y1 = LV_COORD_MAX, .x2 = LV_COORD_MIN, .y2 = LV_COORD_MIN}; 63 | 64 | for(i = 0; i < point_cnt; i++) { 65 | poly_coords.x1 = LV_MATH_MIN(poly_coords.x1, points[i].x); 66 | poly_coords.y1 = LV_MATH_MIN(poly_coords.y1, points[i].y); 67 | poly_coords.x2 = LV_MATH_MAX(poly_coords.x2, points[i].x); 68 | poly_coords.y2 = LV_MATH_MAX(poly_coords.y2, points[i].y); 69 | } 70 | 71 | 72 | bool is_common; 73 | lv_area_t poly_mask; 74 | is_common = _lv_area_intersect(&poly_mask, &poly_coords, clip_area); 75 | if(!is_common) return; 76 | 77 | /*Find the lowest point*/ 78 | lv_coord_t y_min = points[0].y; 79 | int16_t y_min_i = 0; 80 | 81 | for(i = 1; i < point_cnt; i++) { 82 | if(points[i].y < y_min) { 83 | y_min = points[i].y; 84 | y_min_i = i; 85 | } 86 | } 87 | 88 | lv_draw_mask_line_param_t * mp = _lv_mem_buf_get(sizeof(lv_draw_mask_line_param_t) * point_cnt); 89 | lv_draw_mask_line_param_t * mp_next = mp; 90 | 91 | int32_t i_prev_left = y_min_i; 92 | int32_t i_prev_right = y_min_i; 93 | int32_t i_next_left; 94 | int32_t i_next_right; 95 | uint32_t mask_cnt = 0; 96 | 97 | /* Check if the order of points is inverted or not. 98 | * The normal case is when the left point is on `y_min_i - 1`*/ 99 | i_next_left = y_min_i - 1; 100 | if(i_next_left < 0) i_next_left = point_cnt + i_next_left; 101 | 102 | i_next_right = y_min_i + 1; 103 | if(i_next_right > point_cnt - 1) i_next_right = 0; 104 | 105 | bool inv = false; 106 | if(points[i_next_left].x > points[i_next_right].x && points[i_next_left].y < points[i_next_right].y) inv = true; 107 | 108 | do { 109 | if(!inv) { 110 | i_next_left = i_prev_left - 1; 111 | if(i_next_left < 0) i_next_left = point_cnt + i_next_left; 112 | 113 | i_next_right = i_prev_right + 1; 114 | if(i_next_right > point_cnt - 1) i_next_right = 0; 115 | } 116 | else { 117 | i_next_left = i_prev_left + 1; 118 | if(i_next_left > point_cnt - 1) i_next_left = 0; 119 | 120 | i_next_right = i_prev_right - 1; 121 | if(i_next_right < 0) i_next_right = point_cnt + i_next_right; 122 | } 123 | 124 | if(points[i_next_left].y >= points[i_prev_left].y) { 125 | if(points[i_next_left].y != points[i_prev_left].y && 126 | points[i_next_left].x != points[i_prev_left].x) { 127 | lv_draw_mask_line_points_init(mp_next, points[i_prev_left].x, points[i_prev_left].y, 128 | points[i_next_left].x, points[i_next_left].y, 129 | LV_DRAW_MASK_LINE_SIDE_RIGHT); 130 | lv_draw_mask_add(mp_next, mp); 131 | mp_next++; 132 | } 133 | mask_cnt++; 134 | i_prev_left = i_next_left; 135 | } 136 | 137 | if(mask_cnt == point_cnt) break; 138 | 139 | if(points[i_next_right].y >= points[i_prev_right].y) { 140 | if(points[i_next_right].y != points[i_prev_right].y && 141 | points[i_next_right].x != points[i_prev_right].x) { 142 | 143 | lv_draw_mask_line_points_init(mp_next, points[i_prev_right].x, points[i_prev_right].y, 144 | points[i_next_right].x, points[i_next_right].y, 145 | LV_DRAW_MASK_LINE_SIDE_LEFT); 146 | lv_draw_mask_add(mp_next, mp); 147 | mp_next++; 148 | } 149 | mask_cnt++; 150 | i_prev_right = i_next_right; 151 | } 152 | 153 | } while(mask_cnt < point_cnt); 154 | 155 | lv_draw_rect(&poly_coords, clip_area, draw_dsc); 156 | 157 | lv_draw_mask_remove_custom(mp); 158 | 159 | _lv_mem_buf_release(mp); 160 | 161 | } 162 | 163 | /********************** 164 | * STATIC FUNCTIONS 165 | **********************/ 166 | -------------------------------------------------------------------------------- /lvgl/lv_draw/lv_draw_triangle.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_draw_triangle.h 3 | * 4 | */ 5 | 6 | #ifndef LV_DRAW_TRIANGLE_H 7 | #define LV_DRAW_TRIANGLE_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "lv_draw_rect.h" 17 | 18 | /********************* 19 | * DEFINES 20 | *********************/ 21 | 22 | /********************** 23 | * TYPEDEFS 24 | **********************/ 25 | 26 | /********************** 27 | * GLOBAL PROTOTYPES 28 | **********************/ 29 | 30 | /** 31 | * Draw a triangle 32 | * @param points pointer to an array with 3 points 33 | * @param clip_area the triangle will be drawn only in this area 34 | * @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable 35 | */ 36 | void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip, const lv_draw_rect_dsc_t * draw_dsc); 37 | 38 | /** 39 | * Draw a polygon. Only convex polygons are supported. 40 | * @param points an array of points 41 | * @param point_cnt number of points 42 | * @param clip_area polygon will be drawn only in this area 43 | * @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable 44 | */ 45 | void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * mask, 46 | const lv_draw_rect_dsc_t * draw_dsc); 47 | 48 | /********************** 49 | * MACROS 50 | **********************/ 51 | 52 | #ifdef __cplusplus 53 | } /* extern "C" */ 54 | #endif 55 | 56 | #endif /*LV_DRAW_TRIANGLE_H*/ 57 | -------------------------------------------------------------------------------- /lvgl/lv_draw/lv_img_cache.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_img_cache.h 3 | * 4 | */ 5 | 6 | #ifndef LV_IMG_CACHE_H 7 | #define LV_IMG_CACHE_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "lv_img_decoder.h" 17 | 18 | /********************* 19 | * DEFINES 20 | *********************/ 21 | 22 | /********************** 23 | * TYPEDEFS 24 | **********************/ 25 | 26 | /** 27 | * When loading images from the network it can take a long time to download and decode the image. 28 | * 29 | * To avoid repeating this heavy load images can be cached. 30 | */ 31 | typedef struct { 32 | lv_img_decoder_dsc_t dec_dsc; /**< Image information */ 33 | 34 | /** Count the cache entries's life. Add `time_tio_open` to `life` when the entry is used. 35 | * Decrement all lifes by one every in every ::lv_img_cache_open. 36 | * If life == 0 the entry can be reused */ 37 | int32_t life; 38 | } lv_img_cache_entry_t; 39 | 40 | /********************** 41 | * GLOBAL PROTOTYPES 42 | **********************/ 43 | 44 | /** 45 | * Open an image using the image decoder interface and cache it. 46 | * The image will be left open meaning if the image decoder open callback allocated memory then it will remain. 47 | * The image is closed if a new image is opened and the new image takes its place in the cache. 48 | * @param src source of the image. Path to file or pointer to an `lv_img_dsc_t` variable 49 | * @param color The color of the image with `LV_IMG_CF_ALPHA_...` 50 | * @return pointer to the cache entry or NULL if can open the image 51 | */ 52 | lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color); 53 | 54 | /** 55 | * Set the number of images to be cached. 56 | * More cached images mean more opened image at same time which might mean more memory usage. 57 | * E.g. if 20 PNG or JPG images are open in the RAM they consume memory while opened in the cache. 58 | * @param new_entry_cnt number of image to cache 59 | */ 60 | void lv_img_cache_set_size(uint16_t new_slot_num); 61 | 62 | /** 63 | * Invalidate an image source in the cache. 64 | * Useful if the image source is updated therefore it needs to be cached again. 65 | * @param src an image source path to a file or pointer to an `lv_img_dsc_t` variable. 66 | */ 67 | void lv_img_cache_invalidate_src(const void * src); 68 | 69 | /********************** 70 | * MACROS 71 | **********************/ 72 | 73 | #ifdef __cplusplus 74 | } /* extern "C" */ 75 | #endif 76 | 77 | #endif /*LV_IMG_CACHE_H*/ 78 | -------------------------------------------------------------------------------- /lvgl/lv_font/lv_font.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_font.c 3 | * 4 | */ 5 | 6 | /********************* 7 | * INCLUDES 8 | *********************/ 9 | 10 | #include "lv_font.h" 11 | #include "../lv_misc/lv_utils.h" 12 | #include "../lv_misc/lv_log.h" 13 | 14 | /********************* 15 | * DEFINES 16 | *********************/ 17 | 18 | /********************** 19 | * TYPEDEFS 20 | **********************/ 21 | 22 | /********************** 23 | * STATIC PROTOTYPES 24 | **********************/ 25 | 26 | /********************** 27 | * STATIC VARIABLES 28 | **********************/ 29 | 30 | /********************** 31 | * GLOBAL PROTOTYPES 32 | **********************/ 33 | 34 | /********************** 35 | * MACROS 36 | **********************/ 37 | 38 | /********************** 39 | * GLOBAL FUNCTIONS 40 | **********************/ 41 | 42 | /** 43 | * Return with the bitmap of a font. 44 | * @param font_p pointer to a font 45 | * @param letter an UNICODE character code 46 | * @return pointer to the bitmap of the letter 47 | */ 48 | const uint8_t * lv_font_get_glyph_bitmap(const lv_font_t * font_p, uint32_t letter) 49 | { 50 | return font_p->get_glyph_bitmap(font_p, letter); 51 | } 52 | 53 | /** 54 | * Get the descriptor of a glyph 55 | * @param font_p pointer to font 56 | * @param dsc_out store the result descriptor here 57 | * @param letter an UNICODE letter code 58 | * @return true: descriptor is successfully loaded into `dsc_out`. 59 | * false: the letter was not found, no data is loaded to `dsc_out` 60 | */ 61 | bool lv_font_get_glyph_dsc(const lv_font_t * font_p, lv_font_glyph_dsc_t * dsc_out, uint32_t letter, 62 | uint32_t letter_next) 63 | { 64 | return font_p->get_glyph_dsc(font_p, dsc_out, letter, letter_next); 65 | } 66 | 67 | /** 68 | * Get the width of a glyph with kerning 69 | * @param font pointer to a font 70 | * @param letter an UNICODE letter 71 | * @param letter_next the next letter after `letter`. Used for kerning 72 | * @return the width of the glyph 73 | */ 74 | uint16_t lv_font_get_glyph_width(const lv_font_t * font, uint32_t letter, uint32_t letter_next) 75 | { 76 | lv_font_glyph_dsc_t g; 77 | bool ret; 78 | ret = lv_font_get_glyph_dsc(font, &g, letter, letter_next); 79 | if(ret) return g.adv_w; 80 | else return 0; 81 | } 82 | 83 | /********************** 84 | * STATIC FUNCTIONS 85 | **********************/ 86 | -------------------------------------------------------------------------------- /lvgl/lv_font/lv_font.mk: -------------------------------------------------------------------------------- 1 | CSRCS += lv_font.c 2 | CSRCS += lv_font_fmt_txt.c 3 | CSRCS += lv_font_loader.c 4 | CSRCS += lv_font_montserrat_12.c 5 | CSRCS += lv_font_montserrat_14.c 6 | CSRCS += lv_font_montserrat_16.c 7 | CSRCS += lv_font_montserrat_18.c 8 | CSRCS += lv_font_montserrat_20.c 9 | CSRCS += lv_font_montserrat_22.c 10 | CSRCS += lv_font_montserrat_24.c 11 | CSRCS += lv_font_montserrat_26.c 12 | CSRCS += lv_font_montserrat_28.c 13 | CSRCS += lv_font_montserrat_30.c 14 | CSRCS += lv_font_montserrat_32.c 15 | CSRCS += lv_font_montserrat_34.c 16 | CSRCS += lv_font_montserrat_36.c 17 | CSRCS += lv_font_montserrat_38.c 18 | CSRCS += lv_font_montserrat_40.c 19 | CSRCS += lv_font_montserrat_42.c 20 | CSRCS += lv_font_montserrat_44.c 21 | CSRCS += lv_font_montserrat_46.c 22 | CSRCS += lv_font_montserrat_48.c 23 | CSRCS += lv_font_montserrat_12_subpx.c 24 | CSRCS += lv_font_montserrat_28_compressed.c 25 | CSRCS += lv_font_unscii_8.c 26 | CSRCS += lv_font_dejavu_16_persian_hebrew.c 27 | 28 | DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font 29 | VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font 30 | 31 | CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font" 32 | -------------------------------------------------------------------------------- /lvgl/lv_font/lv_font_loader.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_font_loader.h 3 | * 4 | */ 5 | 6 | #ifndef LV_FONT_LOADER_H 7 | #define LV_FONT_LOADER_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | 17 | /********************* 18 | * DEFINES 19 | *********************/ 20 | 21 | /********************** 22 | * TYPEDEFS 23 | **********************/ 24 | 25 | /********************** 26 | * GLOBAL PROTOTYPES 27 | **********************/ 28 | 29 | #if LV_USE_FILESYSTEM 30 | 31 | lv_font_t * lv_font_load(const char * fontName); 32 | void lv_font_free(lv_font_t * font); 33 | 34 | #endif 35 | 36 | /********************** 37 | * MACROS 38 | **********************/ 39 | 40 | #ifdef __cplusplus 41 | } /* extern "C" */ 42 | #endif 43 | 44 | #endif /*LV_FONT_LOADER_H*/ 45 | -------------------------------------------------------------------------------- /lvgl/lv_gpu/lv_gpu.mk: -------------------------------------------------------------------------------- 1 | CSRCS += lv_gpu_stm32_dma2d.c 2 | 3 | DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_gpu 4 | VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_gpu 5 | 6 | CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_gpu" 7 | -------------------------------------------------------------------------------- /lvgl/lv_gpu/lv_gpu_nxp_pxp_osa.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_gpu_nxp_pxp_osa.c 3 | * 4 | */ 5 | 6 | /** 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 NXP 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights to 14 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 15 | * the Software, and to permit persons to whom the Software is furnished to do so, 16 | * subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice (including the next paragraph) 19 | * shall be included in all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 22 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 23 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 25 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 26 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | * 28 | */ 29 | 30 | /********************* 31 | * INCLUDES 32 | *********************/ 33 | 34 | #include "../lv_conf_internal.h" 35 | 36 | #if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT 37 | 38 | #include "lv_gpu_nxp_pxp.h" 39 | #include "fsl_pxp.h" 40 | 41 | #if defined(FSL_RTOS_FREE_RTOS) 42 | #include "FreeRTOS.h" 43 | #include "semphr.h" 44 | #endif 45 | 46 | 47 | /********************* 48 | * DEFINES 49 | *********************/ 50 | 51 | /********************** 52 | * TYPEDEFS 53 | **********************/ 54 | 55 | /********************** 56 | * STATIC PROTOTYPES 57 | **********************/ 58 | static lv_res_t _lv_gpu_nxp_pxp_interrupt_init(void); 59 | static void _lv_gpu_nxp_pxp_interrupt_deinit(void); 60 | static void _lv_gpu_nxp_pxp_run(void); 61 | 62 | /********************** 63 | * STATIC VARIABLES 64 | **********************/ 65 | 66 | #if defined(FSL_RTOS_FREE_RTOS) 67 | static SemaphoreHandle_t s_pxpIdle; 68 | #else 69 | static volatile bool s_pxpIdle; 70 | #endif 71 | 72 | /********************** 73 | * MACROS 74 | **********************/ 75 | 76 | /********************** 77 | * GLOBAL FUNCTIONS 78 | **********************/ 79 | 80 | /** 81 | * PXP device interrupt handler. Used to check PXP task completion status. 82 | */ 83 | void PXP_IRQHandler(void) 84 | { 85 | #if defined(FSL_RTOS_FREE_RTOS) 86 | BaseType_t taskAwake = pdFALSE; 87 | #endif 88 | 89 | if(kPXP_CompleteFlag & PXP_GetStatusFlags(LV_GPU_NXP_PXP_ID)) { 90 | PXP_ClearStatusFlags(LV_GPU_NXP_PXP_ID, kPXP_CompleteFlag); 91 | #if defined(FSL_RTOS_FREE_RTOS) 92 | xSemaphoreGiveFromISR(s_pxpIdle, &taskAwake); 93 | portYIELD_FROM_ISR(taskAwake); 94 | #else 95 | s_pxpIdle = true; 96 | #endif 97 | 98 | } 99 | } 100 | 101 | /********************** 102 | * STATIC FUNCTIONS 103 | **********************/ 104 | 105 | /** 106 | * PXP interrupt initialization. 107 | */ 108 | static lv_res_t _lv_gpu_nxp_pxp_interrupt_init(void) 109 | { 110 | #if defined(FSL_RTOS_FREE_RTOS) 111 | s_pxpIdle = xSemaphoreCreateBinary(); 112 | if(s_pxpIdle == NULL) { 113 | return LV_RES_INV; 114 | } 115 | 116 | NVIC_SetPriority(LV_GPU_NXP_PXP_IRQ_ID, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1); 117 | #else 118 | s_pxpIdle = true; 119 | #endif 120 | 121 | NVIC_EnableIRQ(LV_GPU_NXP_PXP_IRQ_ID); 122 | 123 | return LV_RES_OK; 124 | } 125 | 126 | /** 127 | * PXP interrupt de-initialization. 128 | */ 129 | static void _lv_gpu_nxp_pxp_interrupt_deinit(void) 130 | { 131 | NVIC_DisableIRQ(LV_GPU_NXP_PXP_IRQ_ID); 132 | #if defined(FSL_RTOS_FREE_RTOS) 133 | vSemaphoreDelete(s_pxpIdle); 134 | #endif 135 | } 136 | 137 | /** 138 | * Function to start PXP job. This function must wait for task complete. 139 | */ 140 | static void _lv_gpu_nxp_pxp_run(void) 141 | { 142 | #if !defined(FSL_RTOS_FREE_RTOS) 143 | s_pxpIdle = false; 144 | #endif 145 | 146 | PXP_EnableInterrupts(LV_GPU_NXP_PXP_ID, kPXP_CompleteInterruptEnable); 147 | PXP_Start(LV_GPU_NXP_PXP_ID); 148 | 149 | #if defined(FSL_RTOS_FREE_RTOS) 150 | if(xSemaphoreTake(s_pxpIdle, portMAX_DELAY) != pdTRUE) { 151 | LV_LOG_ERROR("xSemaphoreTake error. Task halted."); 152 | for(; ;) ; 153 | } 154 | #else 155 | while(s_pxpIdle == false) { 156 | } 157 | #endif 158 | } 159 | 160 | lv_nxp_pxp_cfg_t pxp_default_cfg = { 161 | .pxp_interrupt_init = _lv_gpu_nxp_pxp_interrupt_init, 162 | .pxp_interrupt_deinit = _lv_gpu_nxp_pxp_interrupt_deinit, 163 | .pxp_run = _lv_gpu_nxp_pxp_run 164 | }; 165 | 166 | #endif /* LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT */ 167 | -------------------------------------------------------------------------------- /lvgl/lv_gpu/lv_gpu_nxp_pxp_osa.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_gpu_nxp_pxp_osa.h 3 | * 4 | */ 5 | 6 | /** 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 NXP 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights to 14 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 15 | * the Software, and to permit persons to whom the Software is furnished to do so, 16 | * subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice (including the next paragraph) 19 | * shall be included in all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 22 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 23 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 25 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 26 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | * 28 | */ 29 | 30 | #ifndef LV_SRC_LV_GPU_LV_GPU_NXP_PXP_OSA_H_ 31 | #define LV_SRC_LV_GPU_LV_GPU_NXP_PXP_OSA_H_ 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | #include "../lv_conf_internal.h" 38 | 39 | #if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT 40 | extern lv_nxp_pxp_cfg_t pxp_default_cfg; 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } /* extern "C" */ 45 | #endif 46 | 47 | #endif /* LV_SRC_LV_GPU_LV_GPU_NXP_PXP_OSA_H_ */ 48 | -------------------------------------------------------------------------------- /lvgl/lv_gpu/lv_gpu_nxp_vglite.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_gpu_nxp_vglite.h 3 | * 4 | */ 5 | 6 | /** 7 | * MIT License 8 | * 9 | * Copyright (c) 2020 NXP 10 | * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy 12 | * of this software and associated documentation files (the "Software"), to deal 13 | * in the Software without restriction, including without limitation the rights to 14 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 15 | * the Software, and to permit persons to whom the Software is furnished to do so, 16 | * subject to the following conditions: 17 | * 18 | * The above copyright notice and this permission notice (including the next paragraph) 19 | * shall be included in all copies or substantial portions of the Software. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 22 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 23 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 25 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 26 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | * 28 | */ 29 | 30 | #ifndef LV_SRC_LV_GPU_LV_GPU_NXP_VGLITE_H_ 31 | #define LV_SRC_LV_GPU_LV_GPU_NXP_VGLITE_H_ 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /********************* 38 | * INCLUDES 39 | *********************/ 40 | #include "lv_misc/lv_area.h" 41 | 42 | /********************* 43 | * DEFINES 44 | *********************/ 45 | 46 | /** Stride in px required by VG-Lite HW. Don't change this. */ 47 | #define LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX 16 48 | 49 | #ifndef LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT 50 | /** Minimum area (in pixels) to be filled by VG-Lite with 100% opacity */ 51 | #define LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT 32 52 | #endif 53 | 54 | #ifndef LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT 55 | /** Minimum area (in pixels) to be filled by VG-Lite with transparency */ 56 | #define LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT 32 57 | #endif 58 | 59 | #ifndef LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT 60 | /** Minimum area (in pixels) for image copy with 100% opacity to be handled by VG-Lite */ 61 | #define LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT 32 62 | #endif 63 | 64 | #ifndef LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT 65 | /** Minimum area (in pixels) for image copy with transparency to be handled by VG-Lite */ 66 | #define LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT 32 67 | #endif 68 | 69 | #ifndef LV_GPU_NXP_VG_LITE_LOG_ERRORS 70 | /** Enable logging of VG-Lite erors (\see LV_LOG_ERROR) */ 71 | #define LV_GPU_NXP_VG_LITE_LOG_ERRORS 1 72 | #endif 73 | 74 | /********************** 75 | * TYPEDEFS 76 | **********************/ 77 | 78 | /** 79 | * BLock Image Transfer descriptor structure 80 | */ 81 | typedef struct { 82 | 83 | const lv_color_t * src; /**< Source buffer pointer (must be aligned on 32 bytes) */ 84 | lv_area_t src_area; /**< Area to be copied from source */ 85 | lv_coord_t src_width; /**< Source buffer width */ 86 | lv_coord_t src_height; /**< Source buffer height */ 87 | uint32_t src_stride; /**< Source buffer stride in bytes (must be aligned on 16 px) */ 88 | 89 | const lv_color_t * dst; /**< Destination buffer pointer (must be aligned on 32 bytes) */ 90 | lv_area_t dst_area; /**< Target area in destination buffer (must be the same as src_area) */ 91 | lv_coord_t dst_width; /**< Destination buffer width */ 92 | lv_coord_t dst_height; /**< Destination buffer height */ 93 | uint32_t dst_stride; /**< Destination buffer stride in bytes (must be aligned on 16 px) */ 94 | 95 | lv_opa_t opa; /**< Opacity - alpha mix (0 = source not copied, 255 = 100% opaque) */ 96 | 97 | } lv_gpu_nxp_vglite_blit_info_t; 98 | 99 | /********************** 100 | * MACROS 101 | **********************/ 102 | 103 | /********************** 104 | * GLOBAL FUNCTIONS 105 | **********************/ 106 | 107 | /*** 108 | * Fills rectangular area in buffer. 109 | * @param[in] dest_buf Destination buffer pointer (must be aligned on 32 bytes) 110 | * @param[in] dest_width Destination buffer width in pixels ((must be aligned on 16 px) 111 | * @param[in] dest_height Destination buffer height in pixels 112 | * @param[in] fill_area Area to be filled 113 | * @param[in] color Fill color 114 | * @param[in] opa Opacity (255 = full, 128 = 50% background/50% color, 0 = no fill) 115 | * @retval LV_RES_OK Fill completed 116 | * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS) 117 | */ 118 | lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height, 119 | const lv_area_t * fill_area, lv_color_t color, lv_opa_t opa); 120 | 121 | /*** 122 | * BLock Image Transfer. 123 | * @param[in] blit Description of the transfer 124 | * @retval LV_RES_OK Transfer complete 125 | * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS) 126 | */ 127 | lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit); 128 | 129 | #ifdef __cplusplus 130 | } /* extern "C" */ 131 | #endif 132 | 133 | #endif /* LV_SRC_LV_GPU_LV_GPU_NXP_VGLITE_H_ */ 134 | -------------------------------------------------------------------------------- /lvgl/lv_gpu/lv_gpu_stm32_dma2d.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_gpu_stm32_dma2d.h 3 | * 4 | */ 5 | 6 | #ifndef LV_GPU_STM32_DMA2D_H 7 | #define LV_GPU_STM32_DMA2D_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_misc/lv_area.h" 17 | #include "../lv_misc/lv_color.h" 18 | 19 | /********************* 20 | * DEFINES 21 | *********************/ 22 | 23 | #define LV_DMA2D_ARGB8888 0 24 | #define LV_DMA2D_RGB888 1 25 | #define LV_DMA2D_RGB565 2 26 | #define LV_DMA2D_ARGB1555 3 27 | #define LV_DMA2D_ARGB4444 4 28 | 29 | /********************** 30 | * TYPEDEFS 31 | **********************/ 32 | 33 | /********************** 34 | * GLOBAL PROTOTYPES 35 | **********************/ 36 | 37 | /** 38 | * Turn on the peripheral and set output color mode, this only needs to be done once 39 | */ 40 | void lv_gpu_stm32_dma2d_init(void); 41 | 42 | /** 43 | * Fill an area in the buffer with a color 44 | * @param buf a buffer which should be filled 45 | * @param buf_w width of the buffer in pixels 46 | * @param color fill color 47 | * @param fill_w width to fill in pixels (<= buf_w) 48 | * @param fill_h height to fill in pixels 49 | * @note `buf_w - fill_w` is offset to the next line after fill 50 | */ 51 | void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, lv_coord_t fill_w, 52 | lv_coord_t fill_h); 53 | 54 | 55 | /** 56 | * Fill an area in the buffer with a color but take into account a mask which describes the opacity of each pixel 57 | * @param buf a buffer which should be filled using a mask 58 | * @param buf_w width of the buffer in pixels 59 | * @param color fill color 60 | * @param mask 0..255 values describing the opacity of the corresponding pixel. It's width is `fill_w` 61 | * @param opa overall opacity. 255 in `mask` should mean this opacity. 62 | * @param fill_w width to fill in pixels (<= buf_w) 63 | * @param fill_h height to fill in pixels 64 | * @note `buf_w - fill_w` is offset to the next line after fill 65 | */ 66 | void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask, 67 | lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h); 68 | 69 | /** 70 | * Copy a map (typically RGB image) to a buffer 71 | * @param buf a buffer where map should be copied 72 | * @param buf_w width of the buffer in pixels 73 | * @param map an "image" to copy 74 | * @param map_w width of the map in pixels 75 | * @param copy_w width of the area to copy in pixels (<= buf_w) 76 | * @param copy_h height of the area to copy in pixels 77 | * @note `map_w - fill_w` is offset to the next line after copy 78 | */ 79 | void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, 80 | lv_coord_t copy_w, lv_coord_t copy_h); 81 | /** 82 | * Blend a map (e.g. ARGB image or RGB image with opacity) to a buffer 83 | * @param buf a buffer where `map` should be copied 84 | * @param buf_w width of the buffer in pixels 85 | * @param map an "image" to copy 86 | * @param opa opacity of `map` 87 | * @param map_w width of the map in pixels 88 | * @param copy_w width of the area to copy in pixels (<= buf_w) 89 | * @param copy_h height of the area to copy in pixels 90 | * @note `map_w - fill_w` is offset to the next line after copy 91 | */ 92 | void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa, 93 | lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h); 94 | /********************** 95 | * MACROS 96 | **********************/ 97 | 98 | #ifdef __cplusplus 99 | } /* extern "C" */ 100 | #endif 101 | 102 | #endif /*LV_GPU_STM32_DMA2D_H*/ 103 | -------------------------------------------------------------------------------- /lvgl/lv_hal/lv_hal.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_hal.h 3 | * 4 | */ 5 | 6 | #ifndef LV_HAL_H 7 | #define LV_HAL_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "lv_hal_disp.h" 17 | #include "lv_hal_indev.h" 18 | #include "lv_hal_tick.h" 19 | 20 | /********************* 21 | * DEFINES 22 | *********************/ 23 | 24 | /********************** 25 | * TYPEDEFS 26 | **********************/ 27 | 28 | /********************** 29 | * GLOBAL PROTOTYPES 30 | **********************/ 31 | 32 | /********************** 33 | * MACROS 34 | **********************/ 35 | 36 | #ifdef __cplusplus 37 | } /* extern "C" */ 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /lvgl/lv_hal/lv_hal.mk: -------------------------------------------------------------------------------- 1 | CSRCS += lv_hal_disp.c 2 | CSRCS += lv_hal_indev.c 3 | CSRCS += lv_hal_tick.c 4 | 5 | DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_hal 6 | VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_hal 7 | 8 | CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_hal" 9 | -------------------------------------------------------------------------------- /lvgl/lv_hal/lv_hal_indev.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file hal_indev.c 3 | * 4 | * @description Input device HAL interface 5 | * 6 | */ 7 | 8 | /********************* 9 | * INCLUDES 10 | *********************/ 11 | #include "../lv_misc/lv_debug.h" 12 | #include "../lv_hal/lv_hal_indev.h" 13 | #include "../lv_core/lv_indev.h" 14 | #include "../lv_misc/lv_mem.h" 15 | #include "../lv_misc/lv_gc.h" 16 | #include "lv_hal_disp.h" 17 | 18 | #if defined(LV_GC_INCLUDE) 19 | #include LV_GC_INCLUDE 20 | #endif /* LV_ENABLE_GC */ 21 | 22 | /********************* 23 | * DEFINES 24 | *********************/ 25 | 26 | /********************** 27 | * TYPEDEFS 28 | **********************/ 29 | 30 | /********************** 31 | * STATIC PROTOTYPES 32 | **********************/ 33 | 34 | /********************** 35 | * STATIC VARIABLES 36 | **********************/ 37 | 38 | /********************** 39 | * MACROS 40 | **********************/ 41 | 42 | /********************** 43 | * GLOBAL FUNCTIONS 44 | **********************/ 45 | 46 | /** 47 | * Initialize an input device driver with default values. 48 | * It is used to surly have known values in the fields ant not memory junk. 49 | * After it you can set the fields. 50 | * @param driver pointer to driver variable to initialize 51 | */ 52 | void lv_indev_drv_init(lv_indev_drv_t * driver) 53 | { 54 | _lv_memset_00(driver, sizeof(lv_indev_drv_t)); 55 | 56 | driver->type = LV_INDEV_TYPE_NONE; 57 | driver->drag_limit = LV_INDEV_DEF_DRAG_LIMIT; 58 | driver->drag_throw = LV_INDEV_DEF_DRAG_THROW; 59 | driver->long_press_time = LV_INDEV_DEF_LONG_PRESS_TIME; 60 | driver->long_press_rep_time = LV_INDEV_DEF_LONG_PRESS_REP_TIME; 61 | driver->gesture_limit = LV_INDEV_DEF_GESTURE_LIMIT; 62 | driver->gesture_min_velocity = LV_INDEV_DEF_GESTURE_MIN_VELOCITY; 63 | } 64 | 65 | /** 66 | * Register an initialized input device driver. 67 | * @param driver pointer to an initialized 'lv_indev_drv_t' variable (can be local variable) 68 | * @return pointer to the new input device or NULL on error 69 | */ 70 | lv_indev_t * lv_indev_drv_register(lv_indev_drv_t * driver) 71 | { 72 | 73 | if(driver->disp == NULL) driver->disp = lv_disp_get_default(); 74 | 75 | if(driver->disp == NULL) { 76 | LV_LOG_WARN("lv_indev_drv_register: no display registered hence can't attach the indev to " 77 | "a display"); 78 | return NULL; 79 | } 80 | 81 | lv_indev_t * indev = _lv_ll_ins_head(&LV_GC_ROOT(_lv_indev_ll)); 82 | if(!indev) { 83 | LV_ASSERT_MEM(indev); 84 | return NULL; 85 | } 86 | 87 | _lv_memset_00(indev, sizeof(lv_indev_t)); 88 | _lv_memcpy(&indev->driver, driver, sizeof(lv_indev_drv_t)); 89 | 90 | indev->proc.reset_query = 1; 91 | indev->cursor = NULL; 92 | indev->group = NULL; 93 | indev->btn_points = NULL; 94 | 95 | indev->driver.read_task = lv_task_create(_lv_indev_read_task, LV_INDEV_DEF_READ_PERIOD, LV_TASK_PRIO_HIGH, indev); 96 | 97 | return indev; 98 | } 99 | 100 | /** 101 | * Update the driver in run time. 102 | * @param indev pointer to a input device. (return value of `lv_indev_drv_register`) 103 | * @param new_drv pointer to the new driver 104 | */ 105 | void lv_indev_drv_update(lv_indev_t * indev, lv_indev_drv_t * new_drv) 106 | { 107 | memcpy(&indev->driver, new_drv, sizeof(lv_indev_drv_t)); 108 | } 109 | 110 | /** 111 | * Get the next input device. 112 | * @param indev pointer to the current input device. NULL to initialize. 113 | * @return the next input devise or NULL if no more. Give the first input device when the parameter 114 | * is NULL 115 | */ 116 | lv_indev_t * lv_indev_get_next(lv_indev_t * indev) 117 | { 118 | if(indev == NULL) 119 | return _lv_ll_get_head(&LV_GC_ROOT(_lv_indev_ll)); 120 | else 121 | return _lv_ll_get_next(&LV_GC_ROOT(_lv_indev_ll), indev); 122 | } 123 | 124 | /** 125 | * Read data from an input device. 126 | * @param indev pointer to an input device 127 | * @param data input device will write its data here 128 | * @return false: no more data; true: there more data to read (buffered) 129 | */ 130 | bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data) 131 | { 132 | bool cont = false; 133 | 134 | _lv_memset_00(data, sizeof(lv_indev_data_t)); 135 | 136 | /* For touchpad sometimes users don't the last pressed coordinate on release. 137 | * So be sure a coordinates are initialized to the last point */ 138 | if(indev->driver.type == LV_INDEV_TYPE_POINTER) { 139 | data->point.x = indev->proc.types.pointer.act_point.x; 140 | data->point.y = indev->proc.types.pointer.act_point.y; 141 | } 142 | /*Similarly set at least the last key in case of the the user doesn't set it on release*/ 143 | else if(indev->driver.type == LV_INDEV_TYPE_KEYPAD) { 144 | data->key = indev->proc.types.keypad.last_key; 145 | } 146 | /*For compatibility assume that used button was enter (encoder push) */ 147 | else if(indev->driver.type == LV_INDEV_TYPE_ENCODER) { 148 | data->key = LV_KEY_ENTER; 149 | data->enc_diff = 0; 150 | } 151 | 152 | if(indev->driver.read_cb) { 153 | LV_LOG_TRACE("idnev read started"); 154 | cont = indev->driver.read_cb(&indev->driver, data); 155 | LV_LOG_TRACE("idnev read finished"); 156 | } 157 | else { 158 | LV_LOG_WARN("indev function registered"); 159 | } 160 | 161 | return cont; 162 | } 163 | 164 | /********************** 165 | * STATIC FUNCTIONS 166 | **********************/ 167 | -------------------------------------------------------------------------------- /lvgl/lv_hal/lv_hal_tick.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file systick.c 3 | * Provide access to the system tick with 1 millisecond resolution 4 | */ 5 | 6 | /********************* 7 | * INCLUDES 8 | *********************/ 9 | #include "lv_hal_tick.h" 10 | #include 11 | 12 | #if LV_TICK_CUSTOM == 1 13 | #include LV_TICK_CUSTOM_INCLUDE 14 | #endif 15 | 16 | /********************* 17 | * DEFINES 18 | *********************/ 19 | 20 | /********************** 21 | * TYPEDEFS 22 | **********************/ 23 | 24 | /********************** 25 | * STATIC PROTOTYPES 26 | **********************/ 27 | 28 | /********************** 29 | * STATIC VARIABLES 30 | **********************/ 31 | static uint32_t sys_time = 0; 32 | static volatile uint8_t tick_irq_flag; 33 | 34 | /********************** 35 | * MACROS 36 | **********************/ 37 | 38 | /********************** 39 | * GLOBAL FUNCTIONS 40 | **********************/ 41 | 42 | /** 43 | * You have to call this function periodically 44 | * @param tick_period the call period of this function in milliseconds 45 | */ 46 | LV_ATTRIBUTE_TICK_INC void lv_tick_inc(uint32_t tick_period) 47 | { 48 | tick_irq_flag = 0; 49 | sys_time += tick_period; 50 | } 51 | 52 | /** 53 | * Get the elapsed milliseconds since start up 54 | * @return the elapsed milliseconds 55 | */ 56 | uint32_t lv_tick_get(void) 57 | { 58 | #if LV_TICK_CUSTOM == 0 59 | 60 | /* If `lv_tick_inc` is called from an interrupt while `sys_time` is read 61 | * the result might be corrupted. 62 | * This loop detects if `lv_tick_inc` was called while reading `sys_time`. 63 | * If `tick_irq_flag` was cleared in `lv_tick_inc` try to read again 64 | * until `tick_irq_flag` remains `1`. */ 65 | uint32_t result; 66 | do { 67 | tick_irq_flag = 1; 68 | result = sys_time; 69 | } while(!tick_irq_flag); /*Continue until see a non interrupted cycle */ 70 | 71 | return result; 72 | #else 73 | return LV_TICK_CUSTOM_SYS_TIME_EXPR; 74 | #endif 75 | } 76 | 77 | /** 78 | * Get the elapsed milliseconds since a previous time stamp 79 | * @param prev_tick a previous time stamp (return value of systick_get() ) 80 | * @return the elapsed milliseconds since 'prev_tick' 81 | */ 82 | uint32_t lv_tick_elaps(uint32_t prev_tick) 83 | { 84 | uint32_t act_time = lv_tick_get(); 85 | 86 | /*If there is no overflow in sys_time simple subtract*/ 87 | if(act_time >= prev_tick) { 88 | prev_tick = act_time - prev_tick; 89 | } 90 | else { 91 | prev_tick = UINT32_MAX - prev_tick + 1; 92 | prev_tick += act_time; 93 | } 94 | 95 | return prev_tick; 96 | } 97 | 98 | /********************** 99 | * STATIC FUNCTIONS 100 | **********************/ 101 | -------------------------------------------------------------------------------- /lvgl/lv_hal/lv_hal_tick.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_hal_tick.h 3 | * Provide access to the system tick with 1 millisecond resolution 4 | */ 5 | 6 | #ifndef LV_HAL_TICK_H 7 | #define LV_HAL_TICK_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #include 19 | #include 20 | 21 | /********************* 22 | * DEFINES 23 | *********************/ 24 | #ifndef LV_ATTRIBUTE_TICK_INC 25 | #define LV_ATTRIBUTE_TICK_INC 26 | #endif 27 | 28 | /********************** 29 | * TYPEDEFS 30 | **********************/ 31 | 32 | /********************** 33 | * GLOBAL PROTOTYPES 34 | **********************/ 35 | 36 | //! @cond Doxygen_Suppress 37 | 38 | /** 39 | * You have to call this function periodically 40 | * @param tick_period the call period of this function in milliseconds 41 | */ 42 | LV_ATTRIBUTE_TICK_INC void lv_tick_inc(uint32_t tick_period); 43 | 44 | //! @endcond 45 | 46 | /** 47 | * Get the elapsed milliseconds since start up 48 | * @return the elapsed milliseconds 49 | */ 50 | uint32_t lv_tick_get(void); 51 | 52 | /** 53 | * Get the elapsed milliseconds since a previous time stamp 54 | * @param prev_tick a previous time stamp (return value of systick_get() ) 55 | * @return the elapsed milliseconds since 'prev_tick' 56 | */ 57 | uint32_t lv_tick_elaps(uint32_t prev_tick); 58 | 59 | /********************** 60 | * MACROS 61 | **********************/ 62 | 63 | #ifdef __cplusplus 64 | } /* extern "C" */ 65 | #endif 66 | 67 | #endif /*LV_HAL_TICK_H*/ 68 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_async.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_async.c 3 | * 4 | */ 5 | 6 | /********************* 7 | * INCLUDES 8 | *********************/ 9 | 10 | #include "lv_async.h" 11 | 12 | /********************* 13 | * DEFINES 14 | *********************/ 15 | 16 | /********************** 17 | * TYPEDEFS 18 | **********************/ 19 | 20 | /********************** 21 | * STATIC PROTOTYPES 22 | **********************/ 23 | 24 | static void lv_async_task_cb(lv_task_t * task); 25 | 26 | /********************** 27 | * STATIC VARIABLES 28 | **********************/ 29 | 30 | /********************** 31 | * MACROS 32 | **********************/ 33 | 34 | /********************** 35 | * GLOBAL FUNCTIONS 36 | **********************/ 37 | 38 | lv_res_t lv_async_call(lv_async_cb_t async_xcb, void * user_data) 39 | { 40 | /*Allocate an info structure */ 41 | lv_async_info_t * info = lv_mem_alloc(sizeof(lv_async_info_t)); 42 | 43 | if(info == NULL) 44 | return LV_RES_INV; 45 | 46 | /* Create a new task */ 47 | /* Use highest priority so that it will run before a refresh */ 48 | lv_task_t * task = lv_task_create(lv_async_task_cb, 0, LV_TASK_PRIO_HIGHEST, info); 49 | 50 | if(task == NULL) { 51 | lv_mem_free(info); 52 | return LV_RES_INV; 53 | } 54 | 55 | info->cb = async_xcb; 56 | info->user_data = user_data; 57 | 58 | /* Set the task's user data */ 59 | task->user_data = info; 60 | lv_task_set_repeat_count(task, 1); 61 | return LV_RES_OK; 62 | } 63 | 64 | /********************** 65 | * STATIC FUNCTIONS 66 | **********************/ 67 | 68 | static void lv_async_task_cb(lv_task_t * task) 69 | { 70 | lv_async_info_t * info = (lv_async_info_t *)task->user_data; 71 | 72 | info->cb(info->user_data); 73 | 74 | lv_mem_free(info); 75 | } 76 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_async.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_async.h 3 | * 4 | */ 5 | 6 | #ifndef LV_ASYNC_H 7 | #define LV_ASYNC_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | 17 | #include "lv_task.h" 18 | #include "lv_types.h" 19 | 20 | /********************* 21 | * DEFINES 22 | *********************/ 23 | 24 | /********************** 25 | * TYPEDEFS 26 | **********************/ 27 | 28 | /** 29 | * Type for async callback. 30 | */ 31 | typedef void (*lv_async_cb_t)(void *); 32 | 33 | typedef struct _lv_async_info_t { 34 | lv_async_cb_t cb; 35 | void * user_data; 36 | } lv_async_info_t; 37 | 38 | struct _lv_obj_t; 39 | 40 | /********************** 41 | * GLOBAL PROTOTYPES 42 | **********************/ 43 | 44 | /** 45 | * Call an asynchronous function the next time lv_task_handler() is run. This function is likely to return 46 | * **before** the call actually happens! 47 | * @param async_xcb a callback which is the task itself. 48 | * (the 'x' in the argument name indicates that its not a fully generic function because it not follows 49 | * the `func_name(object, callback, ...)` convention) 50 | * @param user_data custom parameter 51 | */ 52 | lv_res_t lv_async_call(lv_async_cb_t async_xcb, void * user_data); 53 | 54 | /********************** 55 | * MACROS 56 | **********************/ 57 | 58 | #ifdef __cplusplus 59 | } /* extern "C" */ 60 | #endif 61 | 62 | #endif /*LV_TEMPL_H*/ 63 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_bidi.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_bifi.h 3 | * 4 | */ 5 | 6 | #ifndef LV_BIDI_H 7 | #define LV_BIDI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #include 19 | #include 20 | 21 | /********************* 22 | * DEFINES 23 | *********************/ 24 | /* Special non printable strong characters. 25 | * They can be inserted to texts to affect the run's direction*/ 26 | #define LV_BIDI_LRO "\xE2\x80\xAD" /*U+202D*/ 27 | #define LV_BIDI_RLO "\xE2\x80\xAE" /*U+202E*/ 28 | 29 | /********************** 30 | * TYPEDEFS 31 | **********************/ 32 | enum { 33 | /*The first 4 values are stored in `lv_obj_t` on 2 bits*/ 34 | LV_BIDI_DIR_LTR = 0x00, 35 | LV_BIDI_DIR_RTL = 0x01, 36 | LV_BIDI_DIR_AUTO = 0x02, 37 | LV_BIDI_DIR_INHERIT = 0x03, 38 | 39 | LV_BIDI_DIR_NEUTRAL = 0x20, 40 | LV_BIDI_DIR_WEAK = 0x21, 41 | }; 42 | 43 | typedef uint8_t lv_bidi_dir_t; 44 | 45 | /********************** 46 | * GLOBAL PROTOTYPES 47 | **********************/ 48 | #if LV_USE_BIDI 49 | 50 | /** 51 | * Convert a text to get the characters in the correct visual order according to 52 | * Unicode Bidirectional Algorithm 53 | * @param str_in the text to process 54 | * @param str_out store the result here. Has the be `strlen(str_in)` length 55 | * @param base_dir `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` 56 | */ 57 | void _lv_bidi_process(const char * str_in, char * str_out, lv_bidi_dir_t base_dir); 58 | 59 | /** 60 | * Auto-detect the direction of a text based on the first strong character 61 | * @param txt the text to process 62 | * @return `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` 63 | */ 64 | lv_bidi_dir_t _lv_bidi_detect_base_dir(const char * txt); 65 | 66 | /** 67 | * Get the logical position of a character in a line 68 | * @param str_in the input string. Can be only one line. 69 | * @param bidi_txt internally the text is bidi processed which buffer can be get here. 70 | * If not required anymore has to freed with `lv_mem_free()` 71 | * Can be `NULL` is unused 72 | * @param len length of the line in character count 73 | * @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` 74 | * @param visual_pos the visual character position which logical position should be get 75 | * @param is_rtl tell the the char at `visual_pos` is RTL or LTR context 76 | * @return the logical character position 77 | */ 78 | uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_bidi_dir_t base_dir, 79 | uint32_t visual_pos, bool * is_rtl); 80 | 81 | /** 82 | * Get the visual position of a character in a line 83 | * @param str_in the input string. Can be only one line. 84 | * @param bidi_txt internally the text is bidi processed which buffer can be get here. 85 | * If not required anymore has to freed with `lv_mem_free()` 86 | * Can be `NULL` is unused 87 | * @param len length of the line in character count 88 | * @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` 89 | * @param logical_pos the logical character position which visual position should be get 90 | * @param is_rtl tell the the char at `logical_pos` is RTL or LTR context 91 | * @return the visual character position 92 | */ 93 | uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_bidi_dir_t base_dir, 94 | uint32_t logical_pos, bool * is_rtl); 95 | 96 | /** 97 | * Bidi process a paragraph of text 98 | * @param str_in the string to process 99 | * @param str_out store the result here 100 | * @param len length of the text 101 | * @param base_dir base dir of the text 102 | * @param pos_conv_out an `uint16_t` array to store the related logical position of the character. 103 | * Can be `NULL` is unused 104 | * @param pos_conv_len length of `pos_conv_out` in element count 105 | */ 106 | void _lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_bidi_dir_t base_dir, 107 | uint16_t * pos_conv_out, uint16_t pos_conv_len); 108 | 109 | /********************** 110 | * MACROS 111 | **********************/ 112 | 113 | #endif /*LV_USE_BIDI*/ 114 | 115 | #ifdef __cplusplus 116 | } /* extern "C" */ 117 | #endif 118 | 119 | #endif /*LV_BIDI_H*/ 120 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_debug.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_debug.c 3 | * 4 | */ 5 | 6 | /********************* 7 | * INCLUDES 8 | *********************/ 9 | #include "lv_debug.h" 10 | 11 | #if LV_USE_DEBUG 12 | 13 | #include "lv_mem.h" 14 | #include 15 | 16 | /********************* 17 | * DEFINES 18 | *********************/ 19 | #ifndef LV_DEBUG_STR_MAX_LENGTH 20 | #define LV_DEBUG_STR_MAX_LENGTH (1024 * 8) 21 | #endif 22 | 23 | #ifndef LV_DEBUG_STR_MAX_REPEAT 24 | #define LV_DEBUG_STR_MAX_REPEAT 8 25 | #endif 26 | /********************** 27 | * TYPEDEFS 28 | **********************/ 29 | 30 | /********************** 31 | * STATIC PROTOTYPES 32 | **********************/ 33 | 34 | /********************** 35 | * STATIC VARIABLES 36 | **********************/ 37 | 38 | /********************** 39 | * MACROS 40 | **********************/ 41 | 42 | /********************** 43 | * GLOBAL FUNCTIONS 44 | **********************/ 45 | 46 | bool lv_debug_check_null(const void * p) 47 | { 48 | if(p) return true; 49 | 50 | return false; 51 | } 52 | 53 | bool lv_debug_check_mem_integrity(void) 54 | { 55 | return lv_mem_test() == LV_RES_OK ? true : false; 56 | } 57 | 58 | bool lv_debug_check_str(const void * str) 59 | { 60 | const uint8_t * s = (const uint8_t *)str; 61 | uint8_t last_byte = 0; 62 | uint32_t rep = 0; 63 | uint32_t i; 64 | 65 | for(i = 0; i < LV_DEBUG_STR_MAX_LENGTH && s[i] != '\0'; i++) { 66 | if(s[i] != last_byte) { 67 | last_byte = s[i]; 68 | rep = 1; 69 | } 70 | else if(s[i] > 0x7F) { 71 | rep++; 72 | if(rep > LV_DEBUG_STR_MAX_REPEAT) { 73 | LV_LOG_WARN("lv_debug_check_str: a non-ASCII char has repeated more than LV_DEBUG_STR_MAX_REPEAT times)"); 74 | return false; 75 | } 76 | } 77 | 78 | if(s[i] < 10) { 79 | LV_LOG_WARN("lv_debug_check_str: invalid char in the string (< 10 value)"); 80 | return false; /*Shouldn't occur in strings*/ 81 | } 82 | } 83 | 84 | if(s[i] == '\0') return true; 85 | 86 | LV_LOG_WARN("lv_debug_check_str: string is longer than LV_DEBUG_STR_MAX_LENGTH"); 87 | return false; 88 | } 89 | 90 | void lv_debug_log_error(const char * msg, uint64_t value) 91 | { 92 | static const char hex[] = "0123456789ABCDEF"; 93 | 94 | size_t msg_len = strlen(msg); 95 | uint32_t value_len = sizeof(unsigned long int); 96 | 97 | if(msg_len < 230) { 98 | char buf[255]; 99 | char * bufp = buf; 100 | 101 | /*Add the function name*/ 102 | _lv_memcpy(bufp, msg, msg_len); 103 | bufp += msg_len; 104 | 105 | /*Add value in hey*/ 106 | *bufp = ' '; 107 | bufp ++; 108 | *bufp = '('; 109 | bufp ++; 110 | *bufp = '0'; 111 | bufp ++; 112 | *bufp = 'x'; 113 | bufp ++; 114 | 115 | int8_t i; 116 | for(i = value_len * 2 - 1; i >= 0; i--) { 117 | uint8_t x = (unsigned long int)((unsigned long int)value >> (i * 4)) & 0xF; 118 | 119 | *bufp = hex[x]; 120 | bufp++; 121 | } 122 | 123 | *bufp = ')'; 124 | bufp ++; 125 | 126 | *bufp = '\0'; 127 | LV_LOG_ERROR(buf); 128 | } 129 | else { 130 | LV_LOG_ERROR(msg); 131 | } 132 | } 133 | 134 | /********************** 135 | * STATIC FUNCTIONS 136 | **********************/ 137 | 138 | 139 | #endif /*LV_USE_DEBUG*/ 140 | 141 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_debug.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_debug.h 3 | * 4 | */ 5 | 6 | #ifndef LV_DEBUG_H 7 | #define LV_DEBUG_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_DEBUG 19 | #include 20 | 21 | /********************* 22 | * DEFINES 23 | *********************/ 24 | 25 | /********************** 26 | * TYPEDEFS 27 | **********************/ 28 | 29 | /********************** 30 | * GLOBAL PROTOTYPES 31 | **********************/ 32 | bool lv_debug_check_null(const void * p); 33 | 34 | bool lv_debug_check_mem_integrity(void); 35 | 36 | bool lv_debug_check_str(const void * str); 37 | 38 | void lv_debug_log_error(const char * msg, uint64_t value); 39 | 40 | /********************** 41 | * MACROS 42 | **********************/ 43 | 44 | #ifndef LV_DEBUG_ASSERT 45 | #define LV_DEBUG_ASSERT(expr, msg, value) \ 46 | do { \ 47 | if(!(expr)) { \ 48 | LV_LOG_ERROR(__func__); \ 49 | lv_debug_log_error(msg, (uint64_t)((uintptr_t)value)); \ 50 | while(1); \ 51 | } \ 52 | } while(0) 53 | #endif 54 | 55 | /*---------------- 56 | * CHECKS 57 | *----------------*/ 58 | 59 | #ifndef LV_DEBUG_IS_NULL 60 | #define LV_DEBUG_IS_NULL(p) (lv_debug_check_null(p)) 61 | #endif 62 | 63 | 64 | #ifndef LV_DEBUG_CHECK_MEM_INTEGRITY 65 | #define LV_DEBUG_CHECK_MEM_INTEGRITY() (lv_debug_check_mem_integrity()) 66 | #endif 67 | 68 | #ifndef LV_DEBUG_IS_STR 69 | #define LV_DEBUG_IS_STR(str) (lv_debug_check_null(str) && \ 70 | lv_debug_check_str(str)) 71 | #endif 72 | 73 | /*----------------- 74 | * ASSERTS 75 | *-----------------*/ 76 | 77 | /*clang-format off*/ 78 | 79 | #if LV_USE_ASSERT_NULL 80 | # ifndef LV_ASSERT_NULL 81 | # define LV_ASSERT_NULL(p) LV_DEBUG_ASSERT(LV_DEBUG_IS_NULL(p), "NULL pointer", p); 82 | # endif 83 | #else 84 | # define LV_ASSERT_NULL(p) 85 | #endif 86 | 87 | #if LV_USE_ASSERT_MEM 88 | # ifndef LV_ASSERT_MEM 89 | # define LV_ASSERT_MEM(p) LV_DEBUG_ASSERT(LV_DEBUG_IS_NULL(p), "Out of memory", p); 90 | # endif 91 | #else 92 | # define LV_ASSERT_MEM(p) 93 | #endif 94 | 95 | #if LV_USE_ASSERT_MEM_INTEGRITY 96 | # ifndef LV_ASSERT_MEM_INTEGRITY 97 | # define LV_ASSERT_MEM_INTEGRITY() LV_DEBUG_ASSERT(LV_DEBUG_CHECK_MEM_INTEGRITY(), "Memory integrity error", 0); 98 | # endif 99 | #else 100 | # define LV_ASSERT_MEM_INTEGRITY() 101 | #endif 102 | 103 | #if LV_USE_ASSERT_STR 104 | # ifndef LV_ASSERT_STR 105 | # define LV_ASSERT_STR(str) LV_DEBUG_ASSERT(LV_DEBUG_IS_STR(str), "Strange or invalid string", str); 106 | # endif 107 | #else /* LV_USE_ASSERT_OBJ == 0 */ 108 | # if LV_USE_ASSERT_NULL /*Use at least LV_ASSERT_NULL if enabled*/ 109 | # define LV_ASSERT_STR(str) LV_ASSERT_NULL(str) 110 | # else 111 | # define LV_ASSERT_STR(str) 112 | # endif 113 | #endif 114 | 115 | 116 | #else /* LV_USE_DEBUG == 0 */ 117 | 118 | #define LV_DEBUG_ASSERT(expr, msg, value) do{}while(0) 119 | 120 | #define LV_ASSERT_NULL(p) 121 | #define LV_ASSERT_MEM(p) 122 | #define LV_ASSERT_MEM_INTEGRITY() 123 | #define LV_ASSERT_STR(p) 124 | #define LV_ASSERT_OBJ(obj, obj_type) 125 | 126 | #endif /* LV_USE_DEBUG */ 127 | /*clang-format on*/ 128 | 129 | #ifdef __cplusplus 130 | } /* extern "C" */ 131 | #endif 132 | 133 | #endif /*LV_DEBUG_H*/ 134 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_gc.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_gc.c 3 | * 4 | */ 5 | 6 | /********************* 7 | * INCLUDES 8 | *********************/ 9 | 10 | #include "lv_gc.h" 11 | #include "string.h" 12 | 13 | #if defined(LV_GC_INCLUDE) 14 | #include LV_GC_INCLUDE 15 | #endif /* LV_ENABLE_GC */ 16 | 17 | /********************* 18 | * DEFINES 19 | *********************/ 20 | 21 | /********************** 22 | * TYPEDEFS 23 | **********************/ 24 | 25 | /********************** 26 | * STATIC PROTOTYPES 27 | **********************/ 28 | 29 | /********************** 30 | * STATIC VARIABLES 31 | **********************/ 32 | 33 | //TODO @heyuanjie87: need? #if(!defined(LV_ENABLE_GC)) || LV_ENABLE_GC == 0 34 | LV_ROOTS 35 | //#endif /* LV_ENABLE_GC */ 36 | 37 | /********************** 38 | * MACROS 39 | **********************/ 40 | 41 | /********************** 42 | * GLOBAL FUNCTIONS 43 | **********************/ 44 | 45 | void _lv_gc_clear_roots(void) 46 | { 47 | #define LV_CLEAR_ROOT(root_type, root_name) _lv_memset_00(&LV_GC_ROOT(root_name), sizeof(LV_GC_ROOT(root_name))); 48 | LV_ITERATE_ROOTS(LV_CLEAR_ROOT) 49 | } 50 | 51 | /********************** 52 | * STATIC FUNCTIONS 53 | **********************/ 54 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_gc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_gc.h 3 | * 4 | */ 5 | 6 | #ifndef LV_GC_H 7 | #define LV_GC_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include 17 | #include 18 | #include "lv_mem.h" 19 | #include "lv_ll.h" 20 | #include "lv_task.h" 21 | #include "../lv_draw/lv_img_cache.h" 22 | #include "../lv_draw/lv_draw_mask.h" 23 | 24 | /********************* 25 | * DEFINES 26 | *********************/ 27 | 28 | #define LV_ITERATE_ROOTS(f) \ 29 | f(lv_ll_t, _lv_task_ll) /*Linked list to store the lv_tasks*/ \ 30 | f(lv_ll_t, _lv_disp_ll) /*Linked list of screens*/ \ 31 | f(lv_ll_t, _lv_indev_ll) /*Linked list of screens*/ \ 32 | f(lv_ll_t, _lv_drv_ll) \ 33 | f(lv_ll_t, _lv_file_ll) \ 34 | f(lv_ll_t, _lv_anim_ll) \ 35 | f(lv_ll_t, _lv_group_ll) \ 36 | f(lv_ll_t, _lv_img_defoder_ll) \ 37 | f(lv_ll_t, _lv_obj_style_trans_ll) \ 38 | f(lv_img_cache_entry_t*, _lv_img_cache_array) \ 39 | f(lv_task_t*, _lv_task_act) \ 40 | f(lv_mem_buf_arr_t , _lv_mem_buf) \ 41 | f(_lv_draw_mask_saved_arr_t , _lv_draw_mask_list) \ 42 | f(void * , _lv_theme_material_styles) \ 43 | f(void * , _lv_theme_template_styles) \ 44 | f(void * , _lv_theme_mono_styles) \ 45 | f(void * , _lv_theme_empty_styles) \ 46 | f(uint8_t *, _lv_font_decompr_buf) \ 47 | f(void *, _lv_user_data) \ 48 | 49 | 50 | #define LV_DEFINE_ROOT(root_type, root_name) root_type root_name; 51 | #define LV_ROOTS LV_ITERATE_ROOTS(LV_DEFINE_ROOT) 52 | 53 | #if LV_ENABLE_GC == 1 54 | #if LV_MEM_CUSTOM != 1 55 | #error "GC requires CUSTOM_MEM" 56 | #endif /* LV_MEM_CUSTOM */ 57 | #else /* LV_ENABLE_GC */ 58 | 59 | #endif /* LV_ENABLE_GC */ 60 | #define LV_GC_ROOT(x) x 61 | #define LV_EXTERN_ROOT(root_type, root_name) extern root_type root_name; 62 | LV_ITERATE_ROOTS(LV_EXTERN_ROOT) 63 | 64 | /********************** 65 | * TYPEDEFS 66 | **********************/ 67 | 68 | /********************** 69 | * GLOBAL PROTOTYPES 70 | **********************/ 71 | 72 | void _lv_gc_clear_roots(void); 73 | 74 | /********************** 75 | * MACROS 76 | **********************/ 77 | 78 | #ifdef __cplusplus 79 | } /* extern "C" */ 80 | #endif 81 | 82 | #endif /*LV_GC_H*/ 83 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_ll.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_ll.c 3 | * Handle linked lists. The nodes are dynamically allocated by the 'lv_mem' module. 4 | */ 5 | 6 | #ifndef LV_LL_H 7 | #define LV_LL_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "lv_mem.h" 17 | #include 18 | #include 19 | #include 20 | 21 | /********************* 22 | * DEFINES 23 | *********************/ 24 | 25 | /********************** 26 | * TYPEDEFS 27 | **********************/ 28 | 29 | /** Dummy type to make handling easier*/ 30 | typedef uint8_t lv_ll_node_t; 31 | 32 | /** Description of a linked list*/ 33 | typedef struct { 34 | uint32_t n_size; 35 | lv_ll_node_t * head; 36 | lv_ll_node_t * tail; 37 | } lv_ll_t; 38 | 39 | /********************** 40 | * GLOBAL PROTOTYPES 41 | **********************/ 42 | 43 | /** 44 | * Initialize linked list 45 | * @param ll_dsc pointer to ll_dsc variable 46 | * @param node_size the size of 1 node in bytes 47 | */ 48 | void _lv_ll_init(lv_ll_t * ll_p, uint32_t node_size); 49 | 50 | /** 51 | * Add a new head to a linked list 52 | * @param ll_p pointer to linked list 53 | * @return pointer to the new head 54 | */ 55 | void * _lv_ll_ins_head(lv_ll_t * ll_p); 56 | 57 | /** 58 | * Insert a new node in front of the n_act node 59 | * @param ll_p pointer to linked list 60 | * @param n_act pointer a node 61 | * @return pointer to the new head 62 | */ 63 | void * _lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act); 64 | 65 | /** 66 | * Add a new tail to a linked list 67 | * @param ll_p pointer to linked list 68 | * @return pointer to the new tail 69 | */ 70 | void * _lv_ll_ins_tail(lv_ll_t * ll_p); 71 | 72 | /** 73 | * Remove the node 'node_p' from 'll_p' linked list. 74 | * It does not free the the memory of node. 75 | * @param ll_p pointer to the linked list of 'node_p' 76 | * @param node_p pointer to node in 'll_p' linked list 77 | */ 78 | void _lv_ll_remove(lv_ll_t * ll_p, void * node_p); 79 | 80 | /** 81 | * Remove and free all elements from a linked list. The list remain valid but become empty. 82 | * @param ll_p pointer to linked list 83 | */ 84 | void _lv_ll_clear(lv_ll_t * ll_p); 85 | 86 | /** 87 | * Move a node to a new linked list 88 | * @param ll_ori_p pointer to the original (old) linked list 89 | * @param ll_new_p pointer to the new linked list 90 | * @param node pointer to a node 91 | * @param head true: be the head in the new list 92 | * false be the head in the new list 93 | */ 94 | void _lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head); 95 | 96 | /** 97 | * Return with head node of the linked list 98 | * @param ll_p pointer to linked list 99 | * @return pointer to the head of 'll_p' 100 | */ 101 | void * _lv_ll_get_head(const lv_ll_t * ll_p); 102 | 103 | /** 104 | * Return with tail node of the linked list 105 | * @param ll_p pointer to linked list 106 | * @return pointer to the head of 'll_p' 107 | */ 108 | void * _lv_ll_get_tail(const lv_ll_t * ll_p); 109 | 110 | /** 111 | * Return with the pointer of the next node after 'n_act' 112 | * @param ll_p pointer to linked list 113 | * @param n_act pointer a node 114 | * @return pointer to the next node 115 | */ 116 | void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act); 117 | 118 | /** 119 | * Return with the pointer of the previous node after 'n_act' 120 | * @param ll_p pointer to linked list 121 | * @param n_act pointer a node 122 | * @return pointer to the previous node 123 | */ 124 | void * _lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act); 125 | 126 | /** 127 | * Return the length of the linked list. 128 | * @param ll_p pointer to linked list 129 | * @return length of the linked list 130 | */ 131 | uint32_t _lv_ll_get_len(const lv_ll_t * ll_p); 132 | 133 | /** 134 | * TODO 135 | * @param ll_p 136 | * @param n1_p 137 | * @param n2_p 138 | void lv_ll_swap(lv_ll_t * ll_p, void * n1_p, void * n2_p); 139 | */ 140 | 141 | /** 142 | * Move a node before an other node in the same linked list 143 | * @param ll_p pointer to a linked list 144 | * @param n_act pointer to node to move 145 | * @param n_after pointer to a node which should be after `n_act` 146 | */ 147 | void _lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after); 148 | 149 | /** 150 | * Check if a linked list is empty 151 | * @param ll_p pointer to a linked list 152 | * @return true: the linked list is empty; false: not empty 153 | */ 154 | bool _lv_ll_is_empty(lv_ll_t * ll_p); 155 | 156 | /********************** 157 | * MACROS 158 | **********************/ 159 | 160 | #define _LV_LL_READ(list, i) for(i = _lv_ll_get_head(&list); i != NULL; i = _lv_ll_get_next(&list, i)) 161 | 162 | #define _LV_LL_READ_BACK(list, i) for(i = _lv_ll_get_tail(&list); i != NULL; i = _lv_ll_get_prev(&list, i)) 163 | 164 | #ifdef __cplusplus 165 | } /* extern "C" */ 166 | #endif 167 | 168 | #endif 169 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_log.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_log.c 3 | * 4 | */ 5 | 6 | /********************* 7 | * INCLUDES 8 | *********************/ 9 | #include "lv_log.h" 10 | #if LV_USE_LOG 11 | 12 | #include 13 | #include 14 | #include "lv_printf.h" 15 | 16 | #if LV_LOG_PRINTF 17 | #include 18 | #endif 19 | 20 | /********************* 21 | * DEFINES 22 | *********************/ 23 | 24 | /********************** 25 | * TYPEDEFS 26 | **********************/ 27 | 28 | /********************** 29 | * STATIC PROTOTYPES 30 | **********************/ 31 | 32 | /********************** 33 | * STATIC VARIABLES 34 | **********************/ 35 | static lv_log_print_g_cb_t custom_print_cb; 36 | 37 | /********************** 38 | * MACROS 39 | **********************/ 40 | 41 | /********************** 42 | * GLOBAL FUNCTIONS 43 | **********************/ 44 | 45 | /** 46 | * Register custom print/write function to call when a log is added. 47 | * It can format its "File path", "Line number" and "Description" as required 48 | * and send the formatted log message to a console or serial port. 49 | * @param print_cb a function pointer to print a log 50 | */ 51 | void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb) 52 | { 53 | custom_print_cb = print_cb; 54 | } 55 | 56 | 57 | /** 58 | * Add a log 59 | * @param level the level of log. (From `lv_log_level_t` enum) 60 | * @param file name of the file when the log added 61 | * @param line line number in the source code where the log added 62 | * @param func name of the function when the log added 63 | * @param format printf-like format string 64 | * @param ... parameters for `format` 65 | */ 66 | void _lv_log_add(lv_log_level_t level, const char * file, int line, const char * func, const char * format, ...) 67 | { 68 | if(level >= _LV_LOG_LEVEL_NUM) return; /*Invalid level*/ 69 | 70 | if(level >= LV_LOG_LEVEL) { 71 | va_list args; 72 | va_start(args, format); 73 | char buf[256]; 74 | lv_vsnprintf(buf, sizeof(buf), format, args); 75 | va_end(args); 76 | 77 | #if LV_LOG_PRINTF 78 | /*Use only the file name not the path*/ 79 | size_t p; 80 | for(p = strlen(file); p > 0; p--) { 81 | if(file[p] == '/' || file[p] == '\\') { 82 | p++; /*Skip the slash*/ 83 | break; 84 | } 85 | } 86 | 87 | static const char * lvl_prefix[] = {"Trace", "Info", "Warn", "Error", "User"}; 88 | printf("%s: %s \t(%s #%d %s())\n", lvl_prefix[level], buf, &file[p], line, func); 89 | #else 90 | if(custom_print_cb) custom_print_cb(level, file, line, func, buf); 91 | #endif 92 | } 93 | } 94 | 95 | /********************** 96 | * STATIC FUNCTIONS 97 | **********************/ 98 | 99 | #endif /*LV_USE_LOG*/ 100 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_log.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_log.h 3 | * 4 | */ 5 | 6 | #ifndef LV_LOG_H 7 | #define LV_LOG_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | #include 18 | 19 | /********************* 20 | * DEFINES 21 | *********************/ 22 | 23 | /*Possible log level. For compatibility declare it independently from `LV_USE_LOG`*/ 24 | 25 | #define LV_LOG_LEVEL_TRACE 0 /**< A lot of logs to give detailed information*/ 26 | #define LV_LOG_LEVEL_INFO 1 /**< Log important events*/ 27 | #define LV_LOG_LEVEL_WARN 2 /**< Log if something unwanted happened but didn't caused problem*/ 28 | #define LV_LOG_LEVEL_ERROR 3 /**< Only critical issue, when the system may fail*/ 29 | #define LV_LOG_LEVEL_USER 4 /**< Custom logs from the user*/ 30 | #define LV_LOG_LEVEL_NONE 5 /**< Do not log anything*/ 31 | #define _LV_LOG_LEVEL_NUM 6 /**< Number of log levels */ 32 | 33 | LV_EXPORT_CONST_INT(LV_LOG_LEVEL_TRACE); 34 | LV_EXPORT_CONST_INT(LV_LOG_LEVEL_INFO); 35 | LV_EXPORT_CONST_INT(LV_LOG_LEVEL_WARN); 36 | LV_EXPORT_CONST_INT(LV_LOG_LEVEL_ERROR); 37 | LV_EXPORT_CONST_INT(LV_LOG_LEVEL_USER); 38 | LV_EXPORT_CONST_INT(LV_LOG_LEVEL_NONE); 39 | 40 | typedef int8_t lv_log_level_t; 41 | 42 | #if LV_USE_LOG 43 | /********************** 44 | * TYPEDEFS 45 | **********************/ 46 | 47 | /** 48 | * Log print function. Receives "Log Level", "File path", "Line number", "Function name" and "Description". 49 | */ 50 | typedef void (*lv_log_print_g_cb_t)(lv_log_level_t level, const char *, uint32_t, const char *, const char *); 51 | 52 | /********************** 53 | * GLOBAL PROTOTYPES 54 | **********************/ 55 | 56 | /** 57 | * Register custom print/write function to call when a log is added. 58 | * It can format its "File path", "Line number" and "Description" as required 59 | * and send the formatted log message to a console or serial port. 60 | * @param print_cb a function pointer to print a log 61 | */ 62 | void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb); 63 | 64 | /** 65 | * Add a log 66 | * @param level the level of log. (From `lv_log_level_t` enum) 67 | * @param file name of the file when the log added 68 | * @param line line number in the source code where the log added 69 | * @param func name of the function when the log added 70 | * @param format printf-like format string 71 | * @param ... parameters for `format` 72 | */ 73 | void _lv_log_add(lv_log_level_t level, const char * file, int line, const char * func, const char * format, ...); 74 | 75 | /********************** 76 | * MACROS 77 | **********************/ 78 | 79 | #if LV_LOG_LEVEL <= LV_LOG_LEVEL_TRACE 80 | #define LV_LOG_TRACE(...) _lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, __func__, __VA_ARGS__); 81 | #else 82 | #define LV_LOG_TRACE(...) 83 | #endif 84 | 85 | #if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO 86 | #define LV_LOG_INFO(...) _lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, __func__, __VA_ARGS__); 87 | #else 88 | #define LV_LOG_INFO(...) 89 | #endif 90 | 91 | #if LV_LOG_LEVEL <= LV_LOG_LEVEL_WARN 92 | #define LV_LOG_WARN(...) _lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, __func__, __VA_ARGS__); 93 | #else 94 | #define LV_LOG_WARN(...) 95 | #endif 96 | 97 | #if LV_LOG_LEVEL <= LV_LOG_LEVEL_ERROR 98 | #define LV_LOG_ERROR(...) _lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, __func__, __VA_ARGS__); 99 | #else 100 | #define LV_LOG_ERROR(...) 101 | #endif 102 | 103 | #if LV_LOG_LEVEL <= LV_LOG_LEVEL_USER 104 | #define LV_LOG_USER(...) _lv_log_add(LV_LOG_LEVEL_USER, __FILE__, __LINE__, __func__, __VA_ARGS__); 105 | #else 106 | #define LV_LOG_USER(...) 107 | #endif 108 | 109 | #else /*LV_USE_LOG*/ 110 | 111 | /*Do nothing if `LV_USE_LOG 0`*/ 112 | #define _lv_log_add(level, file, line, ...) 113 | #define LV_LOG_TRACE(...) 114 | #define LV_LOG_INFO(...) 115 | #define LV_LOG_WARN(...) 116 | #define LV_LOG_ERROR(...) 117 | #define LV_LOG_USER(...) 118 | #endif /*LV_USE_LOG*/ 119 | 120 | #ifdef __cplusplus 121 | } /* extern "C" */ 122 | #endif 123 | 124 | #endif /*LV_LOG_H*/ 125 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_math.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file math_base.h 3 | * 4 | */ 5 | 6 | #ifndef LV_MATH_H 7 | #define LV_MATH_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | #include 18 | 19 | /********************* 20 | * DEFINES 21 | *********************/ 22 | #define LV_MATH_MIN(a, b) ((a) < (b) ? (a) : (b)) 23 | #define LV_MATH_MIN3(a, b, c) (LV_MATH_MIN(LV_MATH_MIN(a,b), c)) 24 | #define LV_MATH_MIN4(a, b, c, d) (LV_MATH_MIN(LV_MATH_MIN(a,b), LV_MATH_MIN(c,d))) 25 | 26 | #define LV_MATH_MAX(a, b) ((a) > (b) ? (a) : (b)) 27 | #define LV_MATH_MAX3(a, b, c) (LV_MATH_MAX(LV_MATH_MAX(a,b), c)) 28 | #define LV_MATH_MAX4(a, b, c, d) (LV_MATH_MAX(LV_MATH_MAX(a,b), LV_MATH_MAX(c,d))) 29 | 30 | #define LV_MATH_ABS(x) ((x) > 0 ? (x) : (-(x))) 31 | 32 | #define LV_MATH_UDIV255(x) ((uint32_t)((uint32_t) (x) * 0x8081) >> 0x17) 33 | 34 | #define LV_IS_SIGNED(t) (((t)(-1)) < ((t) 0)) 35 | #define LV_UMAX_OF(t) (((0x1ULL << ((sizeof(t) * 8ULL) - 1ULL)) - 1ULL) | (0xFULL << ((sizeof(t) * 8ULL) - 4ULL))) 36 | #define LV_SMAX_OF(t) (((0x1ULL << ((sizeof(t) * 8ULL) - 1ULL)) - 1ULL) | (0x7ULL << ((sizeof(t) * 8ULL) - 4ULL))) 37 | #define LV_MAX_OF(t) ((unsigned long) (LV_IS_SIGNED(t) ? LV_SMAX_OF(t) : LV_UMAX_OF(t))) 38 | 39 | #define LV_TRIGO_SIN_MAX 32767 40 | #define LV_TRIGO_SHIFT 15 /**< >> LV_TRIGO_SHIFT to normalize*/ 41 | 42 | #define LV_BEZIER_VAL_MAX 1024 /**< Max time in Bezier functions (not [0..1] to use integers) */ 43 | #define LV_BEZIER_VAL_SHIFT 10 /**< log2(LV_BEZIER_VAL_MAX): used to normalize up scaled values*/ 44 | 45 | /********************** 46 | * TYPEDEFS 47 | **********************/ 48 | 49 | typedef struct { 50 | uint16_t i; 51 | uint16_t f; 52 | } lv_sqrt_res_t; 53 | 54 | 55 | /********************** 56 | * GLOBAL PROTOTYPES 57 | **********************/ 58 | 59 | //! @cond Doxygen_Suppress 60 | /** 61 | * Return with sinus of an angle 62 | * @param angle 63 | * @return sinus of 'angle'. sin(-90) = -32767, sin(90) = 32767 64 | */ 65 | LV_ATTRIBUTE_FAST_MEM int16_t _lv_trigo_sin(int16_t angle); 66 | 67 | //! @endcond 68 | 69 | /** 70 | * Calculate a value of a Cubic Bezier function. 71 | * @param t time in range of [0..LV_BEZIER_VAL_MAX] 72 | * @param u0 start values in range of [0..LV_BEZIER_VAL_MAX] 73 | * @param u1 control value 1 values in range of [0..LV_BEZIER_VAL_MAX] 74 | * @param u2 control value 2 in range of [0..LV_BEZIER_VAL_MAX] 75 | * @param u3 end values in range of [0..LV_BEZIER_VAL_MAX] 76 | * @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX] 77 | */ 78 | int32_t _lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3); 79 | 80 | /** 81 | * Calculate the atan2 of a vector. 82 | * @param x 83 | * @param y 84 | * @return the angle in degree calculated from the given parameters in range of [0..360] 85 | */ 86 | uint16_t _lv_atan2(int x, int y); 87 | 88 | 89 | //! @cond Doxygen_Suppress 90 | 91 | /** 92 | * Get the square root of a number 93 | * @param x integer which square root should be calculated 94 | * @param q store the result here. q->i: integer part, q->f: fractional part in 1/256 unit 95 | * @param mask: optional to skip some iterations if the magnitude of the root is known. 96 | * Set to 0x8000 by default. 97 | * If root < 16: mask = 0x80 98 | * If root < 256: mask = 0x800 99 | * Else: mask = 0x8000 100 | */ 101 | LV_ATTRIBUTE_FAST_MEM void _lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask); 102 | 103 | //! @endcond 104 | 105 | /** 106 | * Calculate the integer exponents. 107 | * @param base 108 | * @param power 109 | * @return base raised to the power exponent 110 | */ 111 | int64_t _lv_pow(int64_t base, int8_t exp); 112 | 113 | /** 114 | * Get the mapped of a number given an input and output range 115 | * @param x integer which mapped value should be calculated 116 | * @param min_in min input range 117 | * @param max_in max input range 118 | * @param min_out max output range 119 | * @param max_out max output range 120 | * @return the mapped number 121 | */ 122 | int16_t _lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min, int32_t max); 123 | 124 | /********************** 125 | * MACROS 126 | **********************/ 127 | 128 | #ifdef __cplusplus 129 | } /* extern "C" */ 130 | #endif 131 | 132 | #endif 133 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_misc.mk: -------------------------------------------------------------------------------- 1 | CSRCS += lv_area.c 2 | CSRCS += lv_task.c 3 | CSRCS += lv_fs.c 4 | CSRCS += lv_anim.c 5 | CSRCS += lv_mem.c 6 | CSRCS += lv_ll.c 7 | CSRCS += lv_color.c 8 | CSRCS += lv_txt.c 9 | CSRCS += lv_txt_ap.c 10 | CSRCS += lv_math.c 11 | CSRCS += lv_log.c 12 | CSRCS += lv_gc.c 13 | CSRCS += lv_utils.c 14 | CSRCS += lv_async.c 15 | CSRCS += lv_printf.c 16 | CSRCS += lv_bidi.c 17 | CSRCS += lv_debug.c 18 | 19 | DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc 20 | VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc 21 | 22 | CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc" 23 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_printf.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // \author (c) Marco Paland (info@paland.com) 3 | // 2014-2019, PALANDesign Hannover, Germany 4 | // 5 | // \license The MIT License (MIT) 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // 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 OR 18 | // 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 FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | // \brief Tiny printf, sprintf and snprintf implementation, optimized for speed on 26 | // embedded systems with a very limited resources. 27 | // Use this instead of bloated standard/newlib printf. 28 | // These routines are thread safe and reentrant. 29 | // 30 | /////////////////////////////////////////////////////////////////////////////// 31 | 32 | #ifndef _LV_PRINTF_H_ 33 | #define _LV_PRINTF_H_ 34 | 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | #include "../lv_conf_internal.h" 41 | 42 | #if LV_SPRINTF_CUSTOM == 0 43 | 44 | #include 45 | #include 46 | 47 | /** 48 | * Tiny snprintf/vsnprintf implementation 49 | * \param buffer A pointer to the buffer where to store the formatted string 50 | * \param count The maximum number of characters to store in the buffer, including a terminating null character 51 | * \param format A string that specifies the format of the output 52 | * \param va A value identifying a variable arguments list 53 | * \return The number of characters that COULD have been written into the buffer, not counting the terminating 54 | * null character. A value equal or larger than count indicates truncation. Only when the returned value 55 | * is non-negative and less than count, the string has been completely written. 56 | */ 57 | int lv_snprintf(char * buffer, size_t count, const char * format, ...); 58 | int lv_vsnprintf(char * buffer, size_t count, const char * format, va_list va); 59 | 60 | #else 61 | #include LV_SPRINTF_INCLUDE 62 | #endif 63 | 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | 70 | #endif // _PRINTF_H_ 71 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_task.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_task.c 3 | * An 'lv_task' is a void (*fp) (void* param) type function which will be called periodically. 4 | * A priority (5 levels + disable) can be assigned to lv_tasks. 5 | */ 6 | 7 | #ifndef LV_TASK_H 8 | #define LV_TASK_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | /********************* 15 | * INCLUDES 16 | *********************/ 17 | #include "../lv_conf_internal.h" 18 | 19 | #include 20 | #include 21 | #include "lv_mem.h" 22 | #include "lv_ll.h" 23 | 24 | /********************* 25 | * DEFINES 26 | *********************/ 27 | #ifndef LV_ATTRIBUTE_TASK_HANDLER 28 | #define LV_ATTRIBUTE_TASK_HANDLER 29 | #endif 30 | 31 | #define LV_NO_TASK_READY 0xFFFFFFFF 32 | /********************** 33 | * TYPEDEFS 34 | **********************/ 35 | 36 | struct _lv_task_t; 37 | 38 | /** 39 | * Tasks execute this type type of functions. 40 | */ 41 | typedef void (*lv_task_cb_t)(struct _lv_task_t *); 42 | 43 | /** 44 | * Possible priorities for lv_tasks 45 | */ 46 | enum { 47 | LV_TASK_PRIO_OFF = 0, 48 | LV_TASK_PRIO_LOWEST, 49 | LV_TASK_PRIO_LOW, 50 | LV_TASK_PRIO_MID, 51 | LV_TASK_PRIO_HIGH, 52 | LV_TASK_PRIO_HIGHEST, 53 | _LV_TASK_PRIO_NUM, 54 | }; 55 | typedef uint8_t lv_task_prio_t; 56 | 57 | /** 58 | * Descriptor of a lv_task 59 | */ 60 | typedef struct _lv_task_t { 61 | uint32_t period; /**< How often the task should run */ 62 | uint32_t last_run; /**< Last time the task ran */ 63 | lv_task_cb_t task_cb; /**< Task function */ 64 | 65 | void * user_data; /**< Custom user data */ 66 | 67 | int32_t repeat_count; /**< 1: Task times; -1 : infinity; 0 : stop ; n>0: residual times */ 68 | uint8_t prio : 3; /**< Task priority */ 69 | } lv_task_t; 70 | 71 | /********************** 72 | * GLOBAL PROTOTYPES 73 | **********************/ 74 | 75 | /** 76 | * Init the lv_task module 77 | */ 78 | void _lv_task_core_init(void); 79 | 80 | //! @cond Doxygen_Suppress 81 | 82 | /** 83 | * Call it periodically to handle lv_tasks. 84 | * @return time till it needs to be run next (in ms) 85 | */ 86 | LV_ATTRIBUTE_TASK_HANDLER uint32_t lv_task_handler(void); 87 | 88 | //! @endcond 89 | 90 | /** 91 | * Create an "empty" task. It needs to initialized with at least 92 | * `lv_task_set_cb` and `lv_task_set_period` 93 | * @return pointer to the created task 94 | */ 95 | lv_task_t * lv_task_create_basic(void); 96 | 97 | /** 98 | * Create a new lv_task 99 | * @param task_xcb a callback which is the task itself. It will be called periodically. 100 | * (the 'x' in the argument name indicates that its not a fully generic function because it not follows 101 | * the `func_name(object, callback, ...)` convention) 102 | * @param period call period in ms unit 103 | * @param prio priority of the task (LV_TASK_PRIO_OFF means the task is stopped) 104 | * @param user_data custom parameter 105 | * @return pointer to the new task 106 | */ 107 | lv_task_t * lv_task_create(lv_task_cb_t task_xcb, uint32_t period, lv_task_prio_t prio, void * user_data); 108 | 109 | /** 110 | * Delete a lv_task 111 | * @param task pointer to task_cb created by task 112 | */ 113 | void lv_task_del(lv_task_t * task); 114 | 115 | /** 116 | * Set the callback the task (the function to call periodically) 117 | * @param task pointer to a task 118 | * @param task_cb the function to call periodically 119 | */ 120 | void lv_task_set_cb(lv_task_t * task, lv_task_cb_t task_cb); 121 | 122 | /** 123 | * Set new priority for a lv_task 124 | * @param task pointer to a lv_task 125 | * @param prio the new priority 126 | */ 127 | void lv_task_set_prio(lv_task_t * task, lv_task_prio_t prio); 128 | 129 | /** 130 | * Set new period for a lv_task 131 | * @param task pointer to a lv_task 132 | * @param period the new period 133 | */ 134 | void lv_task_set_period(lv_task_t * task, uint32_t period); 135 | 136 | /** 137 | * Make a lv_task ready. It will not wait its period. 138 | * @param task pointer to a lv_task. 139 | */ 140 | void lv_task_ready(lv_task_t * task); 141 | 142 | /** 143 | * Set the number of times a task will repeat. 144 | * @param task pointer to a lv_task. 145 | * @param repeat_count -1 : infinity; 0 : stop ; n>0: residual times 146 | */ 147 | void lv_task_set_repeat_count(lv_task_t * task, int32_t repeat_count); 148 | 149 | /** 150 | * Reset a lv_task. 151 | * It will be called the previously set period milliseconds later. 152 | * @param task pointer to a lv_task. 153 | */ 154 | void lv_task_reset(lv_task_t * task); 155 | 156 | /** 157 | * Enable or disable the whole lv_task handling 158 | * @param en: true: lv_task handling is running, false: lv_task handling is suspended 159 | */ 160 | void lv_task_enable(bool en); 161 | 162 | /** 163 | * Get idle percentage 164 | * @return the lv_task idle in percentage 165 | */ 166 | uint8_t lv_task_get_idle(void); 167 | 168 | /** 169 | * Iterate through the tasks 170 | * @param task NULL to start iteration or the previous return value to get the next task 171 | * @return the next task or NULL if there is no more task 172 | */ 173 | lv_task_t * lv_task_get_next(lv_task_t * task); 174 | 175 | /********************** 176 | * MACROS 177 | **********************/ 178 | 179 | #ifdef __cplusplus 180 | } /* extern "C" */ 181 | #endif 182 | 183 | #endif 184 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_templ.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_templ.c 3 | * 4 | */ 5 | 6 | /********************* 7 | * INCLUDES 8 | *********************/ 9 | 10 | /********************* 11 | * DEFINES 12 | *********************/ 13 | 14 | /********************** 15 | * TYPEDEFS 16 | **********************/ 17 | 18 | /* This typedef exists purely to keep -Wpedantic happy when the file is empty. */ 19 | /* It can be removed. */ 20 | typedef int _keep_pedantic_happy; 21 | 22 | /********************** 23 | * STATIC PROTOTYPES 24 | **********************/ 25 | 26 | /********************** 27 | * STATIC VARIABLES 28 | **********************/ 29 | 30 | /********************** 31 | * MACROS 32 | **********************/ 33 | 34 | /********************** 35 | * GLOBAL FUNCTIONS 36 | **********************/ 37 | 38 | /********************** 39 | * STATIC FUNCTIONS 40 | **********************/ 41 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_templ.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_templ.h 3 | * 4 | */ 5 | 6 | #ifndef LV_TEMPL_H 7 | #define LV_TEMPL_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | 17 | /********************* 18 | * DEFINES 19 | *********************/ 20 | 21 | /********************** 22 | * TYPEDEFS 23 | **********************/ 24 | 25 | /********************** 26 | * GLOBAL PROTOTYPES 27 | **********************/ 28 | 29 | /********************** 30 | * MACROS 31 | **********************/ 32 | 33 | #ifdef __cplusplus 34 | } /* extern "C" */ 35 | #endif 36 | 37 | #endif /*LV_TEMPL_H*/ 38 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_txt_ap.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_txt_ap.h 3 | * 4 | */ 5 | 6 | #ifndef LV_TXT_AP_H 7 | #define LV_TXT_AP_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include 17 | #include "lv_txt.h" 18 | #include "../lv_draw/lv_draw.h" 19 | 20 | #if LV_USE_ARABIC_PERSIAN_CHARS == 1 21 | 22 | /********************* 23 | * DEFINES 24 | *********************/ 25 | 26 | #define LV_UNDEF_ARABIC_PERSIAN_CHARS (UINT32_MAX) 27 | #define LV_AP_ALPHABET_BASE_CODE 0x0622 28 | #define LV_AP_END_CHARS_LIST {0,0,0,0,0,{0,0}} 29 | /********************** 30 | * TYPEDEFS 31 | **********************/ 32 | typedef struct { 33 | uint8_t char_offset; 34 | uint16_t char_end_form; 35 | int8_t char_begining_form_offset; 36 | int8_t char_middle_form_offset; 37 | int8_t char_isolated_form_offset; 38 | struct { 39 | uint8_t conj_to_previous; 40 | uint8_t conj_to_next; 41 | } ap_chars_conjunction; 42 | } ap_chars_map_t; 43 | 44 | /********************** 45 | * GLOBAL PROTOTYPES 46 | **********************/ 47 | uint32_t _lv_txt_ap_calc_bytes_cnt(const char * txt); 48 | void _lv_txt_ap_proc(const char * txt, char * txt_out); 49 | 50 | /********************** 51 | * MACROS 52 | **********************/ 53 | 54 | #endif // LV_USE_ARABIC_PERSIAN_CHARS 55 | 56 | #ifdef __cplusplus 57 | } /* extern "C" */ 58 | #endif 59 | 60 | #endif /*LV_TXT_AP_H*/ 61 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_types.h 3 | * 4 | */ 5 | 6 | #ifndef LV_TYPES_H 7 | #define LV_TYPES_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | 17 | /********************* 18 | * DEFINES 19 | *********************/ 20 | 21 | #if defined(__cplusplus) || __STDC_VERSION__ >= 199901L // If c99 or newer, use stdint.h to determine arch size 22 | #include 23 | #endif 24 | 25 | 26 | // If __UINTPTR_MAX__ or UINTPTR_MAX are available, use them to determine arch size 27 | #if defined(__UINTPTR_MAX__) && __UINTPTR_MAX__ > 0xFFFFFFFF 28 | #define LV_ARCH_64 29 | 30 | #elif defined(UINTPTR_MAX) && UINTPTR_MAX > 0xFFFFFFFF 31 | #define LV_ARCH_64 32 | 33 | // Otherwise use compiler-dependent means to determine arch size 34 | #elif defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined (__aarch64__) 35 | #define LV_ARCH_64 36 | 37 | #endif 38 | 39 | 40 | /********************** 41 | * TYPEDEFS 42 | **********************/ 43 | 44 | /** 45 | * LVGL error codes. 46 | */ 47 | enum { 48 | LV_RES_INV = 0, /*Typically indicates that the object is deleted (become invalid) in the action 49 | function or an operation was failed*/ 50 | LV_RES_OK, /*The object is valid (no deleted) after the action*/ 51 | }; 52 | typedef uint8_t lv_res_t; 53 | 54 | 55 | 56 | #if defined(__cplusplus) || __STDC_VERSION__ >= 199901L 57 | // If c99 or newer, use the definition of uintptr_t directly from 58 | typedef uintptr_t lv_uintptr_t; 59 | 60 | #else 61 | 62 | // Otherwise, use the arch size determination 63 | #ifdef LV_ARCH_64 64 | typedef uint64_t lv_uintptr_t; 65 | #else 66 | typedef uint32_t lv_uintptr_t; 67 | #endif 68 | 69 | #endif 70 | 71 | 72 | /********************** 73 | * GLOBAL PROTOTYPES 74 | **********************/ 75 | 76 | /********************** 77 | * MACROS 78 | **********************/ 79 | 80 | #define LV_UNUSED(x) ((void) x) 81 | 82 | #ifdef __cplusplus 83 | } /* extern "C" */ 84 | #endif 85 | 86 | #endif /*LV_TYPES_H*/ 87 | 88 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_utils.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_utils.c 3 | * 4 | */ 5 | 6 | /********************* 7 | * INCLUDES 8 | *********************/ 9 | #include 10 | 11 | #include "lv_utils.h" 12 | #include "lv_math.h" 13 | #include "lv_printf.h" 14 | #include "lv_txt.h" 15 | 16 | /********************* 17 | * DEFINES 18 | *********************/ 19 | 20 | /********************** 21 | * TYPEDEFS 22 | **********************/ 23 | 24 | /********************** 25 | * STATIC PROTOTYPES 26 | **********************/ 27 | 28 | /********************** 29 | * STATIC VARIABLES 30 | **********************/ 31 | 32 | /********************** 33 | * MACROS 34 | **********************/ 35 | 36 | /********************** 37 | * GLOBAL FUNCTIONS 38 | **********************/ 39 | 40 | /** 41 | * Convert a number to string 42 | * @param num a number 43 | * @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements) 44 | * @return same as `buf` (just for convenience) 45 | */ 46 | char * _lv_utils_num_to_str(int32_t num, char * buf) 47 | { 48 | if(num == 0) { 49 | buf[0] = '0'; 50 | buf[1] = '\0'; 51 | return buf; 52 | } 53 | int8_t digitCount = 0; 54 | int8_t i = 0; 55 | if(num < 0) { 56 | buf[digitCount++] = '-'; 57 | num = LV_MATH_ABS(num); 58 | ++i; 59 | } 60 | while(num) { 61 | char digit = num % 10; 62 | buf[digitCount++] = digit + 48; 63 | num /= 10; 64 | } 65 | buf[digitCount] = '\0'; 66 | digitCount--; 67 | while(digitCount > i) { 68 | char temp = buf[i]; 69 | buf[i] = buf[digitCount]; 70 | buf[digitCount] = temp; 71 | digitCount--; 72 | i++; 73 | } 74 | return buf; 75 | } 76 | 77 | /** Searches base[0] to base[n - 1] for an item that matches *key. 78 | * 79 | * @note The function cmp must return negative if its first 80 | * argument (the search key) is less that its second (a table entry), 81 | * zero if equal, and positive if greater. 82 | * 83 | * @note Items in the array must be in ascending order. 84 | * 85 | * @param key Pointer to item being searched for 86 | * @param base Pointer to first element to search 87 | * @param n Number of elements 88 | * @param size Size of each element 89 | * @param cmp Pointer to comparison function (see #lv_font_codeCompare as a comparison function 90 | * example) 91 | * 92 | * @return a pointer to a matching item, or NULL if none exists. 93 | */ 94 | void * _lv_utils_bsearch(const void * key, const void * base, uint32_t n, uint32_t size, 95 | int32_t (*cmp)(const void * pRef, const void * pElement)) 96 | { 97 | const char * middle; 98 | int32_t c; 99 | 100 | for(middle = base; n != 0;) { 101 | middle += (n / 2) * size; 102 | if((c = (*cmp)(key, middle)) > 0) { 103 | n = (n / 2) - ((n & 1) == 0); 104 | base = (middle += size); 105 | } 106 | else if(c < 0) { 107 | n /= 2; 108 | middle = base; 109 | } 110 | else { 111 | return (char *)middle; 112 | } 113 | } 114 | return NULL; 115 | } 116 | 117 | /********************** 118 | * STATIC FUNCTIONS 119 | **********************/ 120 | -------------------------------------------------------------------------------- /lvgl/lv_misc/lv_utils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_utils.h 3 | * 4 | */ 5 | 6 | #ifndef LV_UTILS_H 7 | #define LV_UTILS_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include 17 | #include 18 | 19 | /********************* 20 | * DEFINES 21 | *********************/ 22 | 23 | /********************** 24 | * TYPEDEFS 25 | **********************/ 26 | 27 | /********************** 28 | * GLOBAL PROTOTYPES 29 | **********************/ 30 | /** 31 | * Convert a number to string 32 | * @param num a number 33 | * @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements) 34 | * @return same as `buf` (just for convenience) 35 | */ 36 | char * _lv_utils_num_to_str(int32_t num, char * buf); 37 | 38 | /** Searches base[0] to base[n - 1] for an item that matches *key. 39 | * 40 | * @note The function cmp must return negative if its first 41 | * argument (the search key) is less that its second (a table entry), 42 | * zero if equal, and positive if greater. 43 | * 44 | * @note Items in the array must be in ascending order. 45 | * 46 | * @param key Pointer to item being searched for 47 | * @param base Pointer to first element to search 48 | * @param n Number of elements 49 | * @param size Size of each element 50 | * @param cmp Pointer to comparison function (see #lv_font_codeCompare as a comparison function 51 | * example) 52 | * 53 | * @return a pointer to a matching item, or NULL if none exists. 54 | */ 55 | void * _lv_utils_bsearch(const void * key, const void * base, uint32_t n, uint32_t size, 56 | int32_t (*cmp)(const void * pRef, const void * pElement)); 57 | 58 | /********************** 59 | * MACROS 60 | **********************/ 61 | 62 | #ifdef __cplusplus 63 | } /* extern "C" */ 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /lvgl/lv_themes/lv_theme_empty.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_theme_empty.c 3 | * 4 | */ 5 | 6 | /********************* 7 | * INCLUDES 8 | *********************/ 9 | #include 10 | #include "../../lvgl.h" /*To see all the widgets*/ 11 | 12 | #if LV_USE_THEME_EMPTY 13 | 14 | #include "../lv_misc/lv_gc.h" 15 | 16 | #if defined(LV_GC_INCLUDE) 17 | #include LV_GC_INCLUDE 18 | #endif /* LV_ENABLE_GC */ 19 | 20 | /********************* 21 | * DEFINES 22 | *********************/ 23 | 24 | /********************** 25 | * TYPEDEFS 26 | **********************/ 27 | typedef struct { 28 | lv_style_t opa_cover; 29 | } theme_styles_t; 30 | 31 | /********************** 32 | * STATIC PROTOTYPES 33 | **********************/ 34 | static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name); 35 | static void style_init_reset(lv_style_t * style); 36 | 37 | /********************** 38 | * STATIC VARIABLES 39 | **********************/ 40 | static lv_theme_t theme; 41 | static theme_styles_t * styles; 42 | 43 | static bool inited; 44 | 45 | /********************** 46 | * MACROS 47 | **********************/ 48 | 49 | /********************** 50 | * STATIC FUNCTIONS 51 | **********************/ 52 | 53 | /********************** 54 | * GLOBAL FUNCTIONS 55 | **********************/ 56 | 57 | /** 58 | * Initialize the default 59 | * @param color_primary the primary color of the theme 60 | * @param color_secondary the secondary color for the theme 61 | * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` 62 | * @param font_small pointer to a small font 63 | * @param font_normal pointer to a normal font 64 | * @param font_subtitle pointer to a large font 65 | * @param font_title pointer to a extra large font 66 | * @return a pointer to reference this theme later 67 | */ 68 | lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, 69 | const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, 70 | const lv_font_t * font_title) 71 | { 72 | /* This trick is required only to avoid the garbage collection of 73 | * styles' data if LVGL is used in a binding (e.g. Micropython) 74 | * In a general case styles could be simple `static lv_style_t my style` variables*/ 75 | if(!inited) { 76 | LV_GC_ROOT(_lv_theme_empty_styles) = lv_mem_alloc(sizeof(theme_styles_t)); 77 | styles = (theme_styles_t *)LV_GC_ROOT(_lv_theme_empty_styles); 78 | } 79 | 80 | 81 | theme.color_primary = color_primary; 82 | theme.color_secondary = color_secondary; 83 | theme.font_small = font_small; 84 | theme.font_normal = font_normal; 85 | theme.font_subtitle = font_subtitle; 86 | theme.font_title = font_title; 87 | theme.flags = flags; 88 | 89 | style_init_reset(&styles->opa_cover); 90 | lv_style_set_bg_opa(&styles->opa_cover, LV_STATE_DEFAULT, LV_OPA_COVER); 91 | 92 | theme.apply_xcb = NULL; 93 | theme.apply_cb = theme_apply; 94 | return &theme; 95 | } 96 | 97 | 98 | static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name) 99 | { 100 | LV_UNUSED(th); 101 | if(name == LV_THEME_SCR) { 102 | lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); 103 | lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &styles->opa_cover); 104 | } 105 | } 106 | 107 | /********************** 108 | * STATIC FUNCTIONS 109 | **********************/ 110 | 111 | static void style_init_reset(lv_style_t * style) 112 | { 113 | if(inited) lv_style_reset(style); 114 | else lv_style_init(style); 115 | } 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /lvgl/lv_themes/lv_theme_empty.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_theme_material.h 3 | * 4 | */ 5 | 6 | #ifndef LV_THEME_EMPTY_H 7 | #define LV_THEME_EMPTY_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_THEME_EMPTY 19 | 20 | /********************* 21 | * DEFINES 22 | *********************/ 23 | 24 | /********************** 25 | * TYPEDEFS 26 | **********************/ 27 | 28 | /********************** 29 | * GLOBAL PROTOTYPES 30 | **********************/ 31 | 32 | 33 | /** 34 | * Initialize the default 35 | * @param color_primary the primary color of the theme 36 | * @param color_secondary the secondary color for the theme 37 | * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` 38 | * @param font_small pointer to a small font 39 | * @param font_normal pointer to a normal font 40 | * @param font_subtitle pointer to a large font 41 | * @param font_title pointer to a extra large font 42 | * @return a pointer to reference this theme later 43 | */ 44 | lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, 45 | const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, 46 | const lv_font_t * font_title); 47 | /********************** 48 | * MACROS 49 | **********************/ 50 | 51 | #endif 52 | 53 | #ifdef __cplusplus 54 | } /* extern "C" */ 55 | #endif 56 | 57 | #endif /*LV_THEME_ALIEN_H*/ 58 | -------------------------------------------------------------------------------- /lvgl/lv_themes/lv_theme_material.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_theme_material.h 3 | * 4 | */ 5 | 6 | #ifndef LV_THEME_MATERIAL_H 7 | #define LV_THEME_MATERIAL_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_THEME_MATERIAL 19 | 20 | /********************* 21 | * DEFINES 22 | *********************/ 23 | typedef enum { 24 | LV_THEME_MATERIAL_FLAG_DARK = 0x01, 25 | LV_THEME_MATERIAL_FLAG_LIGHT = 0x02, 26 | LV_THEME_MATERIAL_FLAG_NO_TRANSITION = 0x10, 27 | LV_THEME_MATERIAL_FLAG_NO_FOCUS = 0x20, 28 | } lv_theme_material_flag_t; 29 | 30 | /********************** 31 | * TYPEDEFS 32 | **********************/ 33 | 34 | /********************** 35 | * GLOBAL PROTOTYPES 36 | **********************/ 37 | 38 | /** 39 | * Initialize the default 40 | * @param color_primary the primary color of the theme 41 | * @param color_secondary the secondary color for the theme 42 | * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` 43 | * @param font_small pointer to a small font 44 | * @param font_normal pointer to a normal font 45 | * @param font_subtitle pointer to a large font 46 | * @param font_title pointer to a extra large font 47 | * @return a pointer to reference this theme later 48 | */ 49 | lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, 50 | const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, 51 | const lv_font_t * font_title); 52 | /********************** 53 | * MACROS 54 | **********************/ 55 | 56 | #endif 57 | 58 | #ifdef __cplusplus 59 | } /* extern "C" */ 60 | #endif 61 | 62 | #endif /*LV_THEME_MATERIAL_H*/ 63 | -------------------------------------------------------------------------------- /lvgl/lv_themes/lv_theme_mono.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_theme_mono.h 3 | * 4 | */ 5 | 6 | #ifndef LV_THEME_MONO_H 7 | #define LV_THEME_MONO_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_THEME_MONO 19 | 20 | /********************* 21 | * DEFINES 22 | *********************/ 23 | 24 | /********************** 25 | * TYPEDEFS 26 | **********************/ 27 | 28 | /********************** 29 | * GLOBAL PROTOTYPES 30 | **********************/ 31 | 32 | 33 | /** 34 | * Initialize the mono theme. 35 | * @param color_primary the primary color of the theme 36 | * @param color_secondary the secondary color for the theme 37 | * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` 38 | * @param font_small pointer to a small font 39 | * @param font_normal pointer to a normal font 40 | * @param font_subtitle pointer to a large font 41 | * @param font_title pointer to a extra large font 42 | * @return a pointer to reference this theme later 43 | */ 44 | lv_theme_t * lv_theme_mono_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, 45 | const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, 46 | const lv_font_t * font_title); 47 | /********************** 48 | * MACROS 49 | **********************/ 50 | 51 | #endif 52 | 53 | #ifdef __cplusplus 54 | } /* extern "C" */ 55 | #endif 56 | 57 | #endif /*LV_THEME_TEMPLATE_H*/ 58 | -------------------------------------------------------------------------------- /lvgl/lv_themes/lv_theme_template.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_theme_template.h 3 | * 4 | */ 5 | 6 | #ifndef LV_THEME_TEMPLATE_H 7 | #define LV_THEME_TEMPLATE_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_THEME_TEMPLATE 19 | 20 | /********************* 21 | * DEFINES 22 | *********************/ 23 | 24 | /********************** 25 | * TYPEDEFS 26 | **********************/ 27 | 28 | /********************** 29 | * GLOBAL PROTOTYPES 30 | **********************/ 31 | 32 | 33 | /** 34 | * Initialize the default 35 | * @param color_primary the primary color of the theme 36 | * @param color_secondary the secondary color for the theme 37 | * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` 38 | * @param font_small pointer to a small font 39 | * @param font_normal pointer to a normal font 40 | * @param font_subtitle pointer to a large font 41 | * @param font_title pointer to a extra large font 42 | * @return a pointer to reference this theme later 43 | */ 44 | lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, 45 | const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, 46 | const lv_font_t * font_title); 47 | /********************** 48 | * MACROS 49 | **********************/ 50 | 51 | #endif 52 | 53 | #ifdef __cplusplus 54 | } /* extern "C" */ 55 | #endif 56 | 57 | #endif /*LV_THEME_TEMPLATE_H*/ 58 | -------------------------------------------------------------------------------- /lvgl/lv_themes/lv_themes.mk: -------------------------------------------------------------------------------- 1 | CSRCS += lv_theme.c 2 | CSRCS += lv_theme_material.c 3 | CSRCS += lv_theme_mono.c 4 | CSRCS += lv_theme_empty.c 5 | CSRCS += lv_theme_template.c 6 | 7 | DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes 8 | VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes 9 | 10 | CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes" 11 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_bar.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_bar.h 3 | * 4 | */ 5 | 6 | #ifndef LV_BAR_H 7 | #define LV_BAR_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_BAR != 0 19 | 20 | #include "../lv_core/lv_obj.h" 21 | #include "../lv_misc/lv_anim.h" 22 | #include "lv_cont.h" 23 | #include "lv_btn.h" 24 | #include "lv_label.h" 25 | 26 | /********************* 27 | * DEFINES 28 | *********************/ 29 | 30 | /** Bar animation start value. (Not the real value of the Bar just indicates process animation)*/ 31 | #define LV_BAR_ANIM_STATE_START 0 32 | 33 | /** Bar animation end value. (Not the real value of the Bar just indicates process animation)*/ 34 | #define LV_BAR_ANIM_STATE_END 256 35 | 36 | /** Mark no animation is in progress */ 37 | #define LV_BAR_ANIM_STATE_INV -1 38 | 39 | /** log2(LV_BAR_ANIM_STATE_END) used to normalize data*/ 40 | #define LV_BAR_ANIM_STATE_NORM 8 41 | 42 | /********************** 43 | * TYPEDEFS 44 | **********************/ 45 | 46 | enum { 47 | LV_BAR_TYPE_NORMAL, 48 | LV_BAR_TYPE_SYMMETRICAL, 49 | LV_BAR_TYPE_CUSTOM 50 | }; 51 | typedef uint8_t lv_bar_type_t; 52 | 53 | #if LV_USE_ANIMATION 54 | typedef struct { 55 | lv_obj_t * bar; 56 | lv_anim_value_t anim_start; 57 | lv_anim_value_t anim_end; 58 | lv_anim_value_t anim_state; 59 | } lv_bar_anim_t; 60 | #endif 61 | 62 | /** Data of bar*/ 63 | typedef struct { 64 | /*No inherited ext, derived from the base object */ 65 | 66 | /*New data for this type */ 67 | int16_t cur_value; /*Current value of the bar*/ 68 | int16_t min_value; /*Minimum value of the bar*/ 69 | int16_t max_value; /*Maximum value of the bar*/ 70 | int16_t start_value; /*Start value of the bar*/ 71 | lv_area_t indic_area; /*Save the indicator area. MIght be used by derived types*/ 72 | #if LV_USE_ANIMATION 73 | lv_anim_value_t anim_time; 74 | lv_bar_anim_t cur_value_anim; 75 | lv_bar_anim_t start_value_anim; 76 | #endif 77 | uint8_t type : 2; /*Type of bar*/ 78 | lv_style_list_t style_indic; /*Style of the indicator*/ 79 | } lv_bar_ext_t; 80 | 81 | /** Bar parts */ 82 | enum { 83 | LV_BAR_PART_BG, /** Bar background style. */ 84 | LV_BAR_PART_INDIC, /** Bar fill area style. */ 85 | _LV_BAR_PART_VIRTUAL_LAST 86 | }; 87 | typedef uint8_t lv_bar_part_t; 88 | 89 | /********************** 90 | * GLOBAL PROTOTYPES 91 | **********************/ 92 | 93 | /** 94 | * Create a bar objects 95 | * @param par pointer to an object, it will be the parent of the new bar 96 | * @param copy pointer to a bar object, if not NULL then the new object will be copied from it 97 | * @return pointer to the created bar 98 | */ 99 | lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy); 100 | 101 | /*===================== 102 | * Setter functions 103 | *====================*/ 104 | 105 | /** 106 | * Set a new value on the bar 107 | * @param bar pointer to a bar object 108 | * @param value new value 109 | * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately 110 | */ 111 | void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim); 112 | 113 | /** 114 | * Set a new start value on the bar 115 | * @param bar pointer to a bar object 116 | * @param value new start value 117 | * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately 118 | */ 119 | void lv_bar_set_start_value(lv_obj_t * bar, int16_t start_value, lv_anim_enable_t anim); 120 | 121 | /** 122 | * Set minimum and the maximum values of a bar 123 | * @param bar pointer to the bar object 124 | * @param min minimum value 125 | * @param max maximum value 126 | */ 127 | void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max); 128 | 129 | /** 130 | * Set the type of bar. 131 | * @param bar pointer to bar object 132 | * @param type bar type 133 | */ 134 | void lv_bar_set_type(lv_obj_t * bar, lv_bar_type_t type); 135 | 136 | /** 137 | * Set the animation time of the bar 138 | * @param bar pointer to a bar object 139 | * @param anim_time the animation time in milliseconds. 140 | */ 141 | void lv_bar_set_anim_time(lv_obj_t * bar, uint16_t anim_time); 142 | 143 | /*===================== 144 | * Getter functions 145 | *====================*/ 146 | 147 | /** 148 | * Get the value of a bar 149 | * @param bar pointer to a bar object 150 | * @return the value of the bar 151 | */ 152 | int16_t lv_bar_get_value(const lv_obj_t * bar); 153 | 154 | /** 155 | * Get the start value of a bar 156 | * @param bar pointer to a bar object 157 | * @return the start value of the bar 158 | */ 159 | int16_t lv_bar_get_start_value(const lv_obj_t * bar); 160 | 161 | /** 162 | * Get the minimum value of a bar 163 | * @param bar pointer to a bar object 164 | * @return the minimum value of the bar 165 | */ 166 | int16_t lv_bar_get_min_value(const lv_obj_t * bar); 167 | 168 | /** 169 | * Get the maximum value of a bar 170 | * @param bar pointer to a bar object 171 | * @return the maximum value of the bar 172 | */ 173 | int16_t lv_bar_get_max_value(const lv_obj_t * bar); 174 | 175 | /** 176 | * Get the type of bar. 177 | * @param bar pointer to bar object 178 | * @return bar type 179 | */ 180 | lv_bar_type_t lv_bar_get_type(lv_obj_t * bar); 181 | 182 | /** 183 | * Get the animation time of the bar 184 | * @param bar pointer to a bar object 185 | * @return the animation time in milliseconds. 186 | */ 187 | uint16_t lv_bar_get_anim_time(const lv_obj_t * bar); 188 | 189 | /********************** 190 | * MACROS 191 | **********************/ 192 | 193 | #endif /*LV_USE_BAR*/ 194 | 195 | #ifdef __cplusplus 196 | } /* extern "C" */ 197 | #endif 198 | 199 | #endif /*LV_BAR_H*/ 200 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_checkbox.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_cb.h 3 | * 4 | */ 5 | 6 | #ifndef LV_CHECKBOX_H 7 | #define LV_CHECKBOX_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_CHECKBOX != 0 19 | 20 | /*Testing of dependencies*/ 21 | #if LV_USE_BTN == 0 22 | #error "lv_cb: lv_btn is required. Enable it in lv_conf.h (LV_USE_BTN 1) " 23 | #endif 24 | 25 | #if LV_USE_LABEL == 0 26 | #error "lv_cb: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) " 27 | #endif 28 | 29 | #include "../lv_core/lv_obj.h" 30 | #include "lv_btn.h" 31 | #include "lv_label.h" 32 | 33 | /********************* 34 | * DEFINES 35 | *********************/ 36 | 37 | /********************** 38 | * TYPEDEFS 39 | **********************/ 40 | 41 | /*Data of check box*/ 42 | typedef struct { 43 | lv_btn_ext_t bg_btn; /*Ext. of ancestor*/ 44 | /*New data for this type */ 45 | lv_obj_t * bullet; /*Pointer to button*/ 46 | lv_obj_t * label; /*Pointer to label*/ 47 | } lv_checkbox_ext_t; 48 | 49 | /** Checkbox styles. */ 50 | enum { 51 | LV_CHECKBOX_PART_BG = LV_BTN_PART_MAIN, /**< Style of object background. */ 52 | _LV_CHECKBOX_PART_VIRTUAL_LAST, 53 | LV_CHECKBOX_PART_BULLET = _LV_BTN_PART_REAL_LAST, /**< Style of box (released). */ 54 | _LV_CHECKBOX_PART_REAL_LAST 55 | }; 56 | typedef uint8_t lv_checkbox_style_t; 57 | 58 | /********************** 59 | * GLOBAL PROTOTYPES 60 | **********************/ 61 | 62 | /** 63 | * Create a check box objects 64 | * @param par pointer to an object, it will be the parent of the new check box 65 | * @param copy pointer to a check box object, if not NULL then the new object will be copied from it 66 | * @return pointer to the created check box 67 | */ 68 | lv_obj_t * lv_checkbox_create(lv_obj_t * par, const lv_obj_t * copy); 69 | 70 | /*===================== 71 | * Setter functions 72 | *====================*/ 73 | 74 | /** 75 | * Set the text of a check box. `txt` will be copied and may be deallocated 76 | * after this function returns. 77 | * @param cb pointer to a check box 78 | * @param txt the text of the check box. NULL to refresh with the current text. 79 | */ 80 | void lv_checkbox_set_text(lv_obj_t * cb, const char * txt); 81 | 82 | /** 83 | * Set the text of a check box. `txt` must not be deallocated during the life 84 | * of this checkbox. 85 | * @param cb pointer to a check box 86 | * @param txt the text of the check box. NULL to refresh with the current text. 87 | */ 88 | void lv_checkbox_set_text_static(lv_obj_t * cb, const char * txt); 89 | 90 | /** 91 | * Set the state of the check box 92 | * @param cb pointer to a check box object 93 | * @param checked true: make the check box checked; false: make it unchecked 94 | */ 95 | void lv_checkbox_set_checked(lv_obj_t * cb, bool checked); 96 | 97 | /** 98 | * Make the check box inactive (disabled) 99 | * @param cb pointer to a check box object 100 | */ 101 | void lv_checkbox_set_disabled(lv_obj_t * cb); 102 | 103 | /** 104 | * Set the state of a check box 105 | * @param cb pointer to a check box object 106 | * @param state the new state of the check box (from lv_btn_state_t enum) 107 | */ 108 | void lv_checkbox_set_state(lv_obj_t * cb, lv_btn_state_t state); 109 | /*===================== 110 | * Getter functions 111 | *====================*/ 112 | 113 | /** 114 | * Get the text of a check box 115 | * @param cb pointer to check box object 116 | * @return pointer to the text of the check box 117 | */ 118 | const char * lv_checkbox_get_text(const lv_obj_t * cb); 119 | 120 | /** 121 | * Get the current state of the check box 122 | * @param cb pointer to a check box object 123 | * @return true: checked; false: not checked 124 | */ 125 | static inline bool lv_checkbox_is_checked(const lv_obj_t * cb) 126 | { 127 | return lv_btn_get_state(cb) == LV_BTN_STATE_RELEASED ? false : true; 128 | } 129 | 130 | /** 131 | * Get whether the check box is inactive or not. 132 | * @param cb pointer to a check box object 133 | * @return true: inactive; false: not inactive 134 | */ 135 | static inline bool lv_checkbox_is_inactive(const lv_obj_t * cb) 136 | { 137 | return lv_btn_get_state(cb) == LV_BTN_STATE_DISABLED ? true : false; 138 | } 139 | 140 | /** 141 | * Get the current state of a check box 142 | * @param cb pointer to a check box object 143 | * @return the state of the check box (from lv_btn_state_t enum) 144 | */ 145 | static inline lv_btn_state_t lv_checkbox_get_state(const lv_obj_t * cb) 146 | { 147 | return lv_btn_get_state(cb); 148 | } 149 | 150 | /********************** 151 | * MACROS 152 | **********************/ 153 | 154 | #endif /*LV_USE_CHECKBOX*/ 155 | 156 | #ifdef __cplusplus 157 | } /* extern "C" */ 158 | #endif 159 | 160 | #endif /*LV_CHECKBOX_H*/ 161 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_keyboard.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_keyboard.h 3 | * 4 | */ 5 | 6 | #ifndef LV_KEYBOARD_H 7 | #define LV_KEYBOARD_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_KEYBOARD != 0 19 | 20 | /*Testing of dependencies*/ 21 | #if LV_USE_BTNMATRIX == 0 22 | #error "lv_kb: lv_btnm is required. Enable it in lv_conf.h (LV_USE_BTNMATRIX 1) " 23 | #endif 24 | 25 | #if LV_USE_TEXTAREA == 0 26 | #error "lv_kb: lv_ta is required. Enable it in lv_conf.h (LV_USE_TEXTAREA 1) " 27 | #endif 28 | 29 | #include "../lv_core/lv_obj.h" 30 | #include "lv_btnmatrix.h" 31 | 32 | /********************* 33 | * DEFINES 34 | *********************/ 35 | #define LV_KEYBOARD_CTRL_BTN_FLAGS (LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_CLICK_TRIG) 36 | 37 | /********************** 38 | * TYPEDEFS 39 | **********************/ 40 | 41 | /** Current keyboard mode. */ 42 | enum { 43 | LV_KEYBOARD_MODE_TEXT_LOWER, 44 | LV_KEYBOARD_MODE_TEXT_UPPER, 45 | LV_KEYBOARD_MODE_SPECIAL, 46 | LV_KEYBOARD_MODE_NUM, 47 | }; 48 | typedef uint8_t lv_keyboard_mode_t; 49 | 50 | /*Data of keyboard*/ 51 | typedef struct { 52 | lv_btnmatrix_ext_t btnm; /*Ext. of ancestor*/ 53 | /*New data for this type */ 54 | lv_obj_t * ta; /*Pointer to the assigned text area*/ 55 | lv_keyboard_mode_t mode; /*Key map type*/ 56 | uint8_t cursor_mng : 1; /*1: automatically show/hide cursor when a text area is assigned or left*/ 57 | } lv_keyboard_ext_t; 58 | 59 | enum { 60 | LV_KEYBOARD_PART_BG, 61 | LV_KEYBOARD_PART_BTN, 62 | }; 63 | typedef uint8_t lv_keyboard_style_t; 64 | 65 | /********************** 66 | * GLOBAL PROTOTYPES 67 | **********************/ 68 | 69 | /** 70 | * Create a keyboard objects 71 | * @param par pointer to an object, it will be the parent of the new keyboard 72 | * @param copy pointer to a keyboard object, if not NULL then the new object will be copied from it 73 | * @return pointer to the created keyboard 74 | */ 75 | lv_obj_t * lv_keyboard_create(lv_obj_t * par, const lv_obj_t * copy); 76 | 77 | /*===================== 78 | * Setter functions 79 | *====================*/ 80 | 81 | /** 82 | * Assign a Text Area to the Keyboard. The pressed characters will be put there. 83 | * @param kb pointer to a Keyboard object 84 | * @param ta pointer to a Text Area object to write there 85 | */ 86 | void lv_keyboard_set_textarea(lv_obj_t * kb, lv_obj_t * ta); 87 | 88 | /** 89 | * Set a new a mode (text or number map) 90 | * @param kb pointer to a Keyboard object 91 | * @param mode the mode from 'lv_keyboard_mode_t' 92 | */ 93 | void lv_keyboard_set_mode(lv_obj_t * kb, lv_keyboard_mode_t mode); 94 | 95 | /** 96 | * Automatically hide or show the cursor of the current Text Area 97 | * @param kb pointer to a Keyboard object 98 | * @param en true: show cursor on the current text area, false: hide cursor 99 | */ 100 | void lv_keyboard_set_cursor_manage(lv_obj_t * kb, bool en); 101 | 102 | /** 103 | * Set a new map for the keyboard 104 | * @param kb pointer to a Keyboard object 105 | * @param mode keyboard map to alter 'lv_keyboard_mode_t' 106 | * @param map pointer to a string array to describe the map. 107 | * See 'lv_btnmatrix_set_map()' for more info. 108 | */ 109 | void lv_keyboard_set_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const char * map[]); 110 | 111 | /** 112 | * Set the button control map (hidden, disabled etc.) for the keyboard. The 113 | * control map array will be copied and so may be deallocated after this 114 | * function returns. 115 | * @param kb pointer to a keyboard object 116 | * @param mode keyboard ctrl map to alter 'lv_keyboard_mode_t' 117 | * @param ctrl_map pointer to an array of `lv_btn_ctrl_t` control bytes. 118 | * See: `lv_btnmatrix_set_ctrl_map` for more details. 119 | */ 120 | void lv_keyboard_set_ctrl_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const lv_btnmatrix_ctrl_t ctrl_map[]); 121 | 122 | /*===================== 123 | * Getter functions 124 | *====================*/ 125 | 126 | /** 127 | * Assign a Text Area to the Keyboard. The pressed characters will be put there. 128 | * @param kb pointer to a Keyboard object 129 | * @return pointer to the assigned Text Area object 130 | */ 131 | lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t * kb); 132 | 133 | /** 134 | * Set a new a mode (text or number map) 135 | * @param kb pointer to a Keyboard object 136 | * @return the current mode from 'lv_keyboard_mode_t' 137 | */ 138 | lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * kb); 139 | 140 | /** 141 | * Get the current cursor manage mode. 142 | * @param kb pointer to a Keyboard object 143 | * @return true: show cursor on the current text area, false: hide cursor 144 | */ 145 | bool lv_keyboard_get_cursor_manage(const lv_obj_t * kb); 146 | 147 | /** 148 | * Get the current map of a keyboard 149 | * @param kb pointer to a keyboard object 150 | * @return the current map 151 | */ 152 | static inline const char ** lv_keyboard_get_map_array(const lv_obj_t * kb) 153 | { 154 | return lv_btnmatrix_get_map_array(kb); 155 | } 156 | 157 | /*===================== 158 | * Other functions 159 | *====================*/ 160 | 161 | /** 162 | * Default keyboard event to add characters to the Text area and change the map. 163 | * If a custom `event_cb` is added to the keyboard this function be called from it to handle the 164 | * button clicks 165 | * @param kb pointer to a keyboard 166 | * @param event the triggering event 167 | */ 168 | void lv_keyboard_def_event_cb(lv_obj_t * kb, lv_event_t event); 169 | 170 | /********************** 171 | * MACROS 172 | **********************/ 173 | 174 | #endif /*LV_USE_KEYBOARD*/ 175 | 176 | #ifdef __cplusplus 177 | } /* extern "C" */ 178 | #endif 179 | 180 | #endif /*LV_KEYBOARD_H*/ 181 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_led.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_led.h 3 | * 4 | */ 5 | 6 | #ifndef LV_LED_H 7 | #define LV_LED_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_LED != 0 19 | 20 | #include "../lv_core/lv_obj.h" 21 | 22 | /********************* 23 | * DEFINES 24 | *********************/ 25 | 26 | /********************** 27 | * TYPEDEFS 28 | **********************/ 29 | 30 | /*Data of led*/ 31 | typedef struct { 32 | /*No inherited ext.*/ 33 | /*New data for this type */ 34 | uint8_t bright; /*Current brightness of the LED (0..255)*/ 35 | } lv_led_ext_t; 36 | 37 | /*Parts of LED*/ 38 | enum { 39 | LV_LED_PART_MAIN = LV_OBJ_PART_MAIN, 40 | }; 41 | typedef uint8_t lv_led_part_t; 42 | 43 | /********************** 44 | * GLOBAL PROTOTYPES 45 | **********************/ 46 | 47 | /** 48 | * Create a led objects 49 | * @param par pointer to an object, it will be the parent of the new led 50 | * @param copy pointer to a led object, if not NULL then the new object will be copied from it 51 | * @return pointer to the created led 52 | */ 53 | lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy); 54 | 55 | /** 56 | * Set the brightness of a LED object 57 | * @param led pointer to a LED object 58 | * @param bright LV_LED_BRIGHT_MIN (max. dark) ... LV_LED_BRIGHT_MAX (max. light) 59 | */ 60 | void lv_led_set_bright(lv_obj_t * led, uint8_t bright); 61 | 62 | /** 63 | * Light on a LED 64 | * @param led pointer to a LED object 65 | */ 66 | void lv_led_on(lv_obj_t * led); 67 | 68 | /** 69 | * Light off a LED 70 | * @param led pointer to a LED object 71 | */ 72 | void lv_led_off(lv_obj_t * led); 73 | 74 | /** 75 | * Toggle the state of a LED 76 | * @param led pointer to a LED object 77 | */ 78 | void lv_led_toggle(lv_obj_t * led); 79 | 80 | /** 81 | * Get the brightness of a LEd object 82 | * @param led pointer to LED object 83 | * @return bright 0 (max. dark) ... 255 (max. light) 84 | */ 85 | uint8_t lv_led_get_bright(const lv_obj_t * led); 86 | 87 | /********************** 88 | * MACROS 89 | **********************/ 90 | 91 | #endif /*LV_USE_LED*/ 92 | 93 | #ifdef __cplusplus 94 | } /* extern "C" */ 95 | #endif 96 | 97 | #endif /*LV_LED_H*/ 98 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_line.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_line.h 3 | * 4 | */ 5 | 6 | #ifndef LV_LINE_H 7 | #define LV_LINE_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_LINE != 0 19 | 20 | #include "../lv_core/lv_obj.h" 21 | 22 | /********************* 23 | * DEFINES 24 | *********************/ 25 | 26 | /********************** 27 | * TYPEDEFS 28 | **********************/ 29 | 30 | /*Data of line*/ 31 | typedef struct { 32 | /*Inherited from 'base_obj' so no inherited ext.*/ /*Ext. of ancestor*/ 33 | const lv_point_t * point_array; /*Pointer to an array with the points of the line*/ 34 | uint16_t point_num; /*Number of points in 'point_array' */ 35 | uint8_t auto_size : 1; /*1: set obj. width to x max and obj. height to y max */ 36 | uint8_t y_inv : 1; /*1: y == 0 will be on the bottom*/ 37 | } lv_line_ext_t; 38 | 39 | /*Styles*/ 40 | enum { 41 | LV_LINE_PART_MAIN, 42 | }; 43 | typedef uint8_t lv_line_style_t; 44 | 45 | /********************** 46 | * GLOBAL PROTOTYPES 47 | **********************/ 48 | 49 | /** 50 | * Create a line objects 51 | * @param par pointer to an object, it will be the parent of the new line 52 | * @return pointer to the created line 53 | */ 54 | lv_obj_t * lv_line_create(lv_obj_t * par, const lv_obj_t * copy); 55 | 56 | /*===================== 57 | * Setter functions 58 | *====================*/ 59 | 60 | /** 61 | * Set an array of points. The line object will connect these points. 62 | * @param line pointer to a line object 63 | * @param point_a an array of points. Only the address is saved, 64 | * so the array can NOT be a local variable which will be destroyed 65 | * @param point_num number of points in 'point_a' 66 | */ 67 | void lv_line_set_points(lv_obj_t * line, const lv_point_t point_a[], uint16_t point_num); 68 | 69 | /** 70 | * Enable (or disable) the auto-size option. The size of the object will fit to its points. 71 | * (set width to x max and height to y max) 72 | * @param line pointer to a line object 73 | * @param en true: auto size is enabled, false: auto size is disabled 74 | */ 75 | void lv_line_set_auto_size(lv_obj_t * line, bool en); 76 | 77 | /** 78 | * Enable (or disable) the y coordinate inversion. 79 | * If enabled then y will be subtracted from the height of the object, 80 | * therefore the y=0 coordinate will be on the bottom. 81 | * @param line pointer to a line object 82 | * @param en true: enable the y inversion, false:disable the y inversion 83 | */ 84 | void lv_line_set_y_invert(lv_obj_t * line, bool en); 85 | 86 | #define lv_line_set_y_inv \ 87 | lv_line_set_y_invert /*The name was inconsistent. In v.6.0 only `lv_line_set_y_invert`will \ 88 | work */ 89 | 90 | 91 | /*===================== 92 | * Getter functions 93 | *====================*/ 94 | 95 | /** 96 | * Get the auto size attribute 97 | * @param line pointer to a line object 98 | * @return true: auto size is enabled, false: disabled 99 | */ 100 | bool lv_line_get_auto_size(const lv_obj_t * line); 101 | 102 | /** 103 | * Get the y inversion attribute 104 | * @param line pointer to a line object 105 | * @return true: y inversion is enabled, false: disabled 106 | */ 107 | bool lv_line_get_y_invert(const lv_obj_t * line); 108 | 109 | /********************** 110 | * MACROS 111 | **********************/ 112 | 113 | #endif /*LV_USE_LINE*/ 114 | 115 | #ifdef __cplusplus 116 | } /* extern "C" */ 117 | #endif 118 | 119 | #endif /*LV_LINE_H*/ 120 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_linemeter.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_linemeter.h 3 | * 4 | */ 5 | 6 | #ifndef LV_LINEMETER_H 7 | #define LV_LINEMETER_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_LINEMETER != 0 19 | 20 | #include "../lv_core/lv_obj.h" 21 | 22 | /********************* 23 | * DEFINES 24 | *********************/ 25 | 26 | /********************** 27 | * TYPEDEFS 28 | **********************/ 29 | /*Data of line meter*/ 30 | typedef struct { 31 | /*No inherited ext.*/ /*Ext. of ancestor*/ 32 | /*New data for this type */ 33 | uint16_t scale_angle; /*Angle of the scale in deg. (0..360)*/ 34 | uint16_t angle_ofs; 35 | uint16_t line_cnt; /*Count of lines */ 36 | int32_t cur_value; 37 | int32_t min_value; 38 | int32_t max_value; 39 | uint8_t mirrored : 1; 40 | } lv_linemeter_ext_t; 41 | 42 | /*Styles*/ 43 | enum { 44 | LV_LINEMETER_PART_MAIN, 45 | _LV_LINEMETER_PART_VIRTUAL_LAST, 46 | _LV_LINEMETER_PART_REAL_LAST = _LV_OBJ_PART_REAL_LAST, 47 | }; 48 | typedef uint8_t lv_linemeter_part_t; 49 | 50 | /********************** 51 | * GLOBAL PROTOTYPES 52 | **********************/ 53 | 54 | /** 55 | * Create a line meter objects 56 | * @param par pointer to an object, it will be the parent of the new line meter 57 | * @param copy pointer to a line meter object, if not NULL then the new object will be copied from 58 | * it 59 | * @return pointer to the created line meter 60 | */ 61 | lv_obj_t * lv_linemeter_create(lv_obj_t * par, const lv_obj_t * copy); 62 | 63 | /*===================== 64 | * Setter functions 65 | *====================*/ 66 | 67 | /** 68 | * Set a new value on the line meter 69 | * @param lmeter pointer to a line meter object 70 | * @param value new value 71 | */ 72 | void lv_linemeter_set_value(lv_obj_t * lmeter, int32_t value); 73 | 74 | /** 75 | * Set minimum and the maximum values of a line meter 76 | * @param lmeter pointer to he line meter object 77 | * @param min minimum value 78 | * @param max maximum value 79 | */ 80 | void lv_linemeter_set_range(lv_obj_t * lmeter, int32_t min, int32_t max); 81 | 82 | /** 83 | * Set the scale settings of a line meter 84 | * @param lmeter pointer to a line meter object 85 | * @param angle angle of the scale (0..360) 86 | * @param line_cnt number of lines 87 | */ 88 | void lv_linemeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint16_t line_cnt); 89 | 90 | /** 91 | * Set the set an offset for the line meter's angles to rotate it. 92 | * @param lmeter pointer to a line meter object 93 | * @param angle angle offset (0..360), rotates clockwise 94 | */ 95 | void lv_linemeter_set_angle_offset(lv_obj_t * lmeter, uint16_t angle); 96 | 97 | /** 98 | * Set the orientation of the meter growth, clockwise or counterclockwise (mirrored) 99 | * @param lmeter pointer to a line meter object 100 | * @param mirror mirror setting 101 | */ 102 | void lv_linemeter_set_mirror(lv_obj_t * lmeter, bool mirror); 103 | 104 | /*===================== 105 | * Getter functions 106 | *====================*/ 107 | 108 | /** 109 | * Get the value of a line meter 110 | * @param lmeter pointer to a line meter object 111 | * @return the value of the line meter 112 | */ 113 | int32_t lv_linemeter_get_value(const lv_obj_t * lmeter); 114 | 115 | /** 116 | * Get the minimum value of a line meter 117 | * @param lmeter pointer to a line meter object 118 | * @return the minimum value of the line meter 119 | */ 120 | int32_t lv_linemeter_get_min_value(const lv_obj_t * lmeter); 121 | 122 | /** 123 | * Get the maximum value of a line meter 124 | * @param lmeter pointer to a line meter object 125 | * @return the maximum value of the line meter 126 | */ 127 | int32_t lv_linemeter_get_max_value(const lv_obj_t * lmeter); 128 | 129 | /** 130 | * Get the scale number of a line meter 131 | * @param lmeter pointer to a line meter object 132 | * @return number of the scale units 133 | */ 134 | uint16_t lv_linemeter_get_line_count(const lv_obj_t * lmeter); 135 | 136 | /** 137 | * Get the scale angle of a line meter 138 | * @param lmeter pointer to a line meter object 139 | * @return angle of the scale 140 | */ 141 | uint16_t lv_linemeter_get_scale_angle(const lv_obj_t * lmeter); 142 | 143 | /** 144 | * Get the offset for the line meter. 145 | * @param lmeter pointer to a line meter object 146 | * @return angle offset (0..360) 147 | */ 148 | uint16_t lv_linemeter_get_angle_offset(lv_obj_t * lmeter); 149 | 150 | 151 | void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uint8_t part); 152 | 153 | /** 154 | * get the mirror setting for the line meter 155 | * @param lmeter pointer to a line meter object 156 | * @return mirror (true or false) 157 | */ 158 | bool lv_linemeter_get_mirror(lv_obj_t * lmeter); 159 | 160 | /********************** 161 | * MACROS 162 | **********************/ 163 | 164 | #endif /*LV_USE_LINEMETER*/ 165 | 166 | #ifdef __cplusplus 167 | } /* extern "C" */ 168 | #endif 169 | 170 | #endif /*LV_LINEMETER_H*/ 171 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_msgbox.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_mbox.h 3 | * 4 | */ 5 | 6 | #ifndef LV_MSGBOX_H 7 | #define LV_MSGBOX_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_MSGBOX != 0 19 | 20 | /*Testing of dependencies*/ 21 | #if LV_USE_CONT == 0 22 | #error "lv_mbox: lv_cont is required. Enable it in lv_conf.h (LV_USE_CONT 1) " 23 | #endif 24 | 25 | #if LV_USE_BTNMATRIX == 0 26 | #error "lv_mbox: lv_btnm is required. Enable it in lv_conf.h (LV_USE_BTNMATRIX 1) " 27 | #endif 28 | 29 | #if LV_USE_LABEL == 0 30 | #error "lv_mbox: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) " 31 | #endif 32 | 33 | #include "../lv_core/lv_obj.h" 34 | #include "lv_cont.h" 35 | #include "lv_btnmatrix.h" 36 | #include "lv_label.h" 37 | 38 | /********************* 39 | * DEFINES 40 | *********************/ 41 | 42 | /********************** 43 | * TYPEDEFS 44 | **********************/ 45 | 46 | /*Data of message box*/ 47 | typedef struct { 48 | lv_cont_ext_t bg; /*Ext. of ancestor*/ 49 | /*New data for this type */ 50 | lv_obj_t * text; /*Text of the message box*/ 51 | lv_obj_t * btnm; /*Button matrix for the buttons*/ 52 | #if LV_USE_ANIMATION 53 | uint16_t anim_time; /*Duration of close animation [ms] (0: no animation)*/ 54 | #endif 55 | } lv_msgbox_ext_t; 56 | 57 | /** Message box styles. */ 58 | enum { 59 | LV_MSGBOX_PART_BG = LV_CONT_PART_MAIN, 60 | 61 | LV_MSGBOX_PART_BTN_BG = _LV_CONT_PART_REAL_LAST, 62 | LV_MSGBOX_PART_BTN, 63 | }; 64 | typedef uint8_t lv_msgbox_style_t; 65 | 66 | /********************** 67 | * GLOBAL PROTOTYPES 68 | **********************/ 69 | 70 | /** 71 | * Create a message box objects 72 | * @param par pointer to an object, it will be the parent of the new message box 73 | * @param copy pointer to a message box object, if not NULL then the new object will be copied from 74 | * it 75 | * @return pointer to the created message box 76 | */ 77 | lv_obj_t * lv_msgbox_create(lv_obj_t * par, const lv_obj_t * copy); 78 | 79 | /*====================== 80 | * Add/remove functions 81 | *=====================*/ 82 | 83 | /** 84 | * Add button to the message box 85 | * @param mbox pointer to message box object 86 | * @param btn_map button descriptor (button matrix map). 87 | * E.g. a const char *txt[] = {"ok", "close", ""} (Can not be local variable) 88 | */ 89 | void lv_msgbox_add_btns(lv_obj_t * mbox, const char * btn_mapaction[]); 90 | 91 | /*===================== 92 | * Setter functions 93 | *====================*/ 94 | 95 | /** 96 | * Set the text of the message box 97 | * @param mbox pointer to a message box 98 | * @param txt a '\0' terminated character string which will be the message box text 99 | */ 100 | void lv_msgbox_set_text(lv_obj_t * mbox, const char * txt); 101 | 102 | /** 103 | * Set animation duration 104 | * @param mbox pointer to a message box object 105 | * @param anim_time animation length in milliseconds (0: no animation) 106 | */ 107 | void lv_msgbox_set_anim_time(lv_obj_t * mbox, uint16_t anim_time); 108 | 109 | /** 110 | * Automatically delete the message box after a given time 111 | * @param mbox pointer to a message box object 112 | * @param delay a time (in milliseconds) to wait before delete the message box 113 | */ 114 | void lv_msgbox_start_auto_close(lv_obj_t * mbox, uint16_t delay); 115 | 116 | /** 117 | * Stop the auto. closing of message box 118 | * @param mbox pointer to a message box object 119 | */ 120 | void lv_msgbox_stop_auto_close(lv_obj_t * mbox); 121 | 122 | /** 123 | * Set whether recoloring is enabled. Must be called after `lv_msgbox_add_btns`. 124 | * @param mbox pointer to message box object 125 | * @param en whether recoloring is enabled 126 | */ 127 | void lv_msgbox_set_recolor(lv_obj_t * mbox, bool en); 128 | 129 | /*===================== 130 | * Getter functions 131 | *====================*/ 132 | 133 | /** 134 | * Get the text of the message box 135 | * @param mbox pointer to a message box object 136 | * @return pointer to the text of the message box 137 | */ 138 | const char * lv_msgbox_get_text(const lv_obj_t * mbox); 139 | 140 | /** 141 | * Get the index of the lastly "activated" button by the user (pressed, released etc) 142 | * Useful in the the `event_cb`. 143 | * @param mbox pointer to message box object 144 | * @return index of the last released button (LV_BTNMATRIX_BTN_NONE: if unset) 145 | */ 146 | uint16_t lv_msgbox_get_active_btn(lv_obj_t * mbox); 147 | 148 | /** 149 | * Get the text of the lastly "activated" button by the user (pressed, released etc) 150 | * Useful in the the `event_cb`. 151 | * @param mbox pointer to message box object 152 | * @return text of the last released button (NULL: if unset) 153 | */ 154 | const char * lv_msgbox_get_active_btn_text(lv_obj_t * mbox); 155 | 156 | /** 157 | * Get the animation duration (close animation time) 158 | * @param mbox pointer to a message box object 159 | * @return animation length in milliseconds (0: no animation) 160 | */ 161 | uint16_t lv_msgbox_get_anim_time(const lv_obj_t * mbox); 162 | 163 | /** 164 | * Get whether recoloring is enabled 165 | * @param mbox pointer to a message box object 166 | * @return whether recoloring is enabled 167 | */ 168 | bool lv_msgbox_get_recolor(const lv_obj_t * mbox); 169 | 170 | /** 171 | * Get message box button matrix 172 | * @param mbox pointer to a message box object 173 | * @return pointer to button matrix object 174 | * @remarks return value will be NULL unless `lv_msgbox_add_btns` has been already called 175 | */ 176 | lv_obj_t * lv_msgbox_get_btnmatrix(lv_obj_t * mbox); 177 | 178 | /********************** 179 | * MACROS 180 | **********************/ 181 | 182 | #endif /*LV_USE_MSGBOX*/ 183 | 184 | #ifdef __cplusplus 185 | } /* extern "C" */ 186 | #endif 187 | 188 | #endif /*LV_MSGBOX_H*/ 189 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_objmask.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_objmask.h 3 | * 4 | */ 5 | 6 | #ifndef LV_OBJMASK_H 7 | #define LV_OBJMASK_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_OBJMASK != 0 19 | 20 | #include "../lv_core/lv_obj.h" 21 | #include "../lv_widgets/lv_cont.h" 22 | 23 | /********************* 24 | * DEFINES 25 | *********************/ 26 | 27 | /********************** 28 | * TYPEDEFS 29 | **********************/ 30 | 31 | typedef struct { 32 | void * param; 33 | } lv_objmask_mask_t; 34 | 35 | /*Data of object mask*/ 36 | typedef struct { 37 | lv_cont_ext_t cont; /*Ext. of ancestor*/ 38 | /*New data for this type */ 39 | lv_ll_t mask_ll; /*Store the created masks*/ 40 | 41 | } lv_objmask_ext_t; 42 | 43 | /*Parts of the object*/ 44 | enum { 45 | LV_OBJMASK_PART_MAIN, 46 | }; 47 | typedef uint8_t lv_objmask_part_t; 48 | 49 | /********************** 50 | * GLOBAL PROTOTYPES 51 | **********************/ 52 | 53 | /** 54 | * Create a object mask objects 55 | * @param par pointer to an object, it will be the parent of the new object mask 56 | * @param copy pointer to a object mask object, if not NULL then the new object will be copied from it 57 | * @return pointer to the created object mask 58 | */ 59 | lv_obj_t * lv_objmask_create(lv_obj_t * par, const lv_obj_t * copy); 60 | 61 | /*====================== 62 | * Add/remove functions 63 | *=====================*/ 64 | 65 | /** 66 | * Add a mask 67 | * @param objmask pointer to an Object mask object 68 | * @param param an initialized mask parameter 69 | * @return pointer to the added mask 70 | */ 71 | lv_objmask_mask_t * lv_objmask_add_mask(lv_obj_t * objmask, void * param); 72 | 73 | /** 74 | * Update an already created mask 75 | * @param objmask pointer to an Object mask object 76 | * @param mask pointer to created mask (returned by `lv_objmask_add_mask`) 77 | * @param param an initialized mask parameter (initialized by `lv_draw_mask_line/angle/.../_init`) 78 | */ 79 | void lv_objmask_update_mask(lv_obj_t * objmask, lv_objmask_mask_t * mask, void * param); 80 | 81 | /** 82 | * Remove a mask 83 | * @param objmask pointer to an Object mask object 84 | * @param mask pointer to created mask (returned by `lv_objmask_add_mask`) 85 | * If `NULL` passed all masks will be deleted. 86 | */ 87 | void lv_objmask_remove_mask(lv_obj_t * objmask, lv_objmask_mask_t * mask); 88 | 89 | /*===================== 90 | * Setter functions 91 | *====================*/ 92 | 93 | /*===================== 94 | * Getter functions 95 | *====================*/ 96 | 97 | /*===================== 98 | * Other functions 99 | *====================*/ 100 | 101 | /********************** 102 | * MACROS 103 | **********************/ 104 | 105 | #endif /*LV_USE_OBJMASK*/ 106 | 107 | #ifdef __cplusplus 108 | } /* extern "C" */ 109 | #endif 110 | 111 | #endif /*LV_OBJMASK_H*/ 112 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_spinbox.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_spinbox.h 3 | * 4 | */ 5 | 6 | #ifndef LV_SPINBOX_H 7 | #define LV_SPINBOX_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_SPINBOX != 0 19 | 20 | /*Testing of dependencies*/ 21 | #if LV_USE_TEXTAREA == 0 22 | #error "lv_spinbox: lv_ta is required. Enable it in lv_conf.h (LV_USE_TEXTAREA 1) " 23 | #endif 24 | 25 | #include "../lv_core/lv_obj.h" 26 | #include "../lv_widgets/lv_textarea.h" 27 | 28 | /********************* 29 | * DEFINES 30 | *********************/ 31 | #define LV_SPINBOX_MAX_DIGIT_COUNT 10 32 | 33 | /********************** 34 | * TYPEDEFS 35 | **********************/ 36 | 37 | /*Data of spinbox*/ 38 | typedef struct { 39 | lv_textarea_ext_t ta; /*Ext. of ancestor*/ 40 | /*New data for this type */ 41 | int32_t value; 42 | int32_t range_max; 43 | int32_t range_min; 44 | int32_t step; 45 | uint8_t rollover : 1; // Set to true for rollover functionality 46 | uint16_t digit_count : 4; 47 | uint16_t dec_point_pos : 4; /*if 0, there is no separator and the number is an integer*/ 48 | uint16_t digit_padding_left : 4; 49 | } lv_spinbox_ext_t; 50 | 51 | /*Styles*/ 52 | enum { 53 | LV_SPINBOX_PART_BG = LV_TEXTAREA_PART_BG, 54 | LV_SPINBOX_PART_CURSOR = LV_TEXTAREA_PART_CURSOR, 55 | _LV_SPINBOX_PART_VIRTUAL_LAST = _LV_TEXTAREA_PART_VIRTUAL_LAST, 56 | _LV_SPINBOX_PART_REAL_LAST = _LV_TEXTAREA_PART_REAL_LAST, 57 | }; 58 | typedef uint8_t lv_spinbox_part_t; 59 | 60 | /********************** 61 | * GLOBAL PROTOTYPES 62 | **********************/ 63 | 64 | /** 65 | * Create a spinbox objects 66 | * @param par pointer to an object, it will be the parent of the new spinbox 67 | * @param copy pointer to a spinbox object, if not NULL then the new object will be copied from it 68 | * @return pointer to the created spinbox 69 | */ 70 | lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy); 71 | 72 | /*===================== 73 | * Setter functions 74 | *====================*/ 75 | 76 | /** 77 | * Set spinbox rollover function 78 | * @param spinbox pointer to spinbox 79 | * @param b true or false to enable or disable (default) 80 | */ 81 | void lv_spinbox_set_rollover(lv_obj_t * spinbox, bool b); 82 | 83 | /** 84 | * Set spinbox value 85 | * @param spinbox pointer to spinbox 86 | * @param i value to be set 87 | */ 88 | void lv_spinbox_set_value(lv_obj_t * spinbox, int32_t i); 89 | 90 | /** 91 | * Set spinbox digit format (digit count and decimal format) 92 | * @param spinbox pointer to spinbox 93 | * @param digit_count number of digit excluding the decimal separator and the sign 94 | * @param separator_position number of digit before the decimal point. If 0, decimal point is not 95 | * shown 96 | */ 97 | void lv_spinbox_set_digit_format(lv_obj_t * spinbox, uint8_t digit_count, uint8_t separator_position); 98 | 99 | /** 100 | * Set spinbox step 101 | * @param spinbox pointer to spinbox 102 | * @param step steps on increment/decrement 103 | */ 104 | void lv_spinbox_set_step(lv_obj_t * spinbox, uint32_t step); 105 | 106 | /** 107 | * Set spinbox value range 108 | * @param spinbox pointer to spinbox 109 | * @param range_min maximum value, inclusive 110 | * @param range_max minimum value, inclusive 111 | */ 112 | void lv_spinbox_set_range(lv_obj_t * spinbox, int32_t range_min, int32_t range_max); 113 | 114 | /** 115 | * Set spinbox left padding in digits count (added between sign and first digit) 116 | * @param spinbox pointer to spinbox 117 | * @param cb Callback function called on value change event 118 | */ 119 | void lv_spinbox_set_padding_left(lv_obj_t * spinbox, uint8_t padding); 120 | 121 | /*===================== 122 | * Getter functions 123 | *====================*/ 124 | 125 | /** 126 | * Get spinbox rollover function status 127 | * @param spinbox pointer to spinbox 128 | */ 129 | bool lv_spinbox_get_rollover(lv_obj_t * spinbox); 130 | 131 | /** 132 | * Get the spinbox numeral value (user has to convert to float according to its digit format) 133 | * @param spinbox pointer to spinbox 134 | * @return value integer value of the spinbox 135 | */ 136 | int32_t lv_spinbox_get_value(lv_obj_t * spinbox); 137 | 138 | /*===================== 139 | * Other functions 140 | *====================*/ 141 | 142 | /** 143 | * Select next lower digit for edition by dividing the step by 10 144 | * @param spinbox pointer to spinbox 145 | */ 146 | void lv_spinbox_step_next(lv_obj_t * spinbox); 147 | 148 | /** 149 | * Select next higher digit for edition by multiplying the step by 10 150 | * @param spinbox pointer to spinbox 151 | */ 152 | void lv_spinbox_step_prev(lv_obj_t * spinbox); 153 | 154 | /** 155 | * Increment spinbox value by one step 156 | * @param spinbox pointer to spinbox 157 | */ 158 | void lv_spinbox_increment(lv_obj_t * spinbox); 159 | 160 | /** 161 | * Decrement spinbox value by one step 162 | * @param spinbox pointer to spinbox 163 | */ 164 | void lv_spinbox_decrement(lv_obj_t * spinbox); 165 | 166 | /********************** 167 | * MACROS 168 | **********************/ 169 | 170 | #endif /*LV_USE_SPINBOX*/ 171 | 172 | #ifdef __cplusplus 173 | } /* extern "C" */ 174 | #endif 175 | 176 | #endif /*LV_SPINBOX_H*/ 177 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_spinner.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_spinner.h 3 | * 4 | */ 5 | 6 | #ifndef LV_SPINNER_H 7 | #define LV_SPINNER_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_SPINNER != 0 19 | 20 | /*Testing of dependencies*/ 21 | #if LV_USE_ARC == 0 22 | #error "lv_spinner: lv_arc is required. Enable it in lv_conf.h (LV_USE_ARC 1) " 23 | #endif 24 | 25 | #if LV_USE_ANIMATION == 0 26 | #error "lv_spinner: animations are required. Enable it in lv_conf.h (LV_USE_ANIMATION 1) " 27 | #endif 28 | 29 | #include "../lv_core/lv_obj.h" 30 | #include "../lv_misc/lv_anim.h" 31 | #include "lv_arc.h" 32 | 33 | /********************* 34 | * DEFINES 35 | *********************/ 36 | 37 | /********************** 38 | * TYPEDEFS 39 | **********************/ 40 | 41 | /** 42 | * Type of spinner. 43 | */ 44 | enum { 45 | LV_SPINNER_TYPE_SPINNING_ARC, 46 | LV_SPINNER_TYPE_FILLSPIN_ARC, 47 | LV_SPINNER_TYPE_CONSTANT_ARC, 48 | }; 49 | typedef uint8_t lv_spinner_type_t; 50 | 51 | /** 52 | * Direction the spinner should spin. 53 | */ 54 | enum { 55 | LV_SPINNER_DIR_FORWARD, 56 | LV_SPINNER_DIR_BACKWARD, 57 | }; 58 | typedef uint8_t lv_spinner_dir_t; 59 | 60 | /*Data of spinner*/ 61 | typedef struct { 62 | lv_arc_ext_t arc; /*Ext. of ancestor*/ 63 | /*New data for this type */ 64 | lv_anim_value_t arc_length; /*Length of the spinning indicator in degree*/ 65 | uint16_t time; /*Time of one round*/ 66 | lv_spinner_type_t anim_type : 2; /*Type of the arc animation*/ 67 | lv_spinner_dir_t anim_dir : 1; /*Animation Direction*/ 68 | } lv_spinner_ext_t; 69 | 70 | /*Parts of the spinner*/ 71 | enum { 72 | LV_SPINNER_PART_BG = LV_ARC_PART_BG, 73 | LV_SPINNER_PART_INDIC = LV_ARC_PART_INDIC, 74 | _LV_SPINNER_PART_VIRTUAL_LAST, 75 | 76 | _LV_SPINNER_PART_REAL_LAST = _LV_ARC_PART_REAL_LAST, 77 | }; 78 | typedef uint8_t lv_spinner_style_t; 79 | 80 | /********************** 81 | * GLOBAL PROTOTYPES 82 | **********************/ 83 | 84 | /** 85 | * Create a spinner object 86 | * @param par pointer to an object, it will be the parent of the new spinner 87 | * @param copy pointer to a spinner object, if not NULL then the new object will be copied from 88 | * it 89 | * @return pointer to the created spinner 90 | */ 91 | lv_obj_t * lv_spinner_create(lv_obj_t * par, const lv_obj_t * copy); 92 | 93 | /*====================== 94 | * Add/remove functions 95 | *=====================*/ 96 | 97 | /** 98 | * Set the length of the spinning arc in degrees 99 | * @param spinner pointer to a spinner object 100 | * @param deg length of the arc 101 | */ 102 | void lv_spinner_set_arc_length(lv_obj_t * spinner, lv_anim_value_t deg); 103 | 104 | /** 105 | * Set the spin time of the arc 106 | * @param spinner pointer to a spinner object 107 | * @param time time of one round in milliseconds 108 | */ 109 | void lv_spinner_set_spin_time(lv_obj_t * spinner, uint16_t time); 110 | 111 | /*===================== 112 | * Setter functions 113 | *====================*/ 114 | 115 | /** 116 | * Set the animation type of a spinner. 117 | * @param spinner pointer to spinner object 118 | * @param type animation type of the spinner 119 | * */ 120 | void lv_spinner_set_type(lv_obj_t * spinner, lv_spinner_type_t type); 121 | 122 | /** 123 | * Set the animation direction of a spinner 124 | * @param spinner pointer to spinner object 125 | * @param direction animation direction of the spinner 126 | */ 127 | void lv_spinner_set_dir(lv_obj_t * spinner, lv_spinner_dir_t dir); 128 | 129 | /*===================== 130 | * Getter functions 131 | *====================*/ 132 | 133 | /** 134 | * Get the arc length [degree] of the a spinner 135 | * @param spinner pointer to a spinner object 136 | */ 137 | lv_anim_value_t lv_spinner_get_arc_length(const lv_obj_t * spinner); 138 | 139 | /** 140 | * Get the spin time of the arc 141 | * @param spinner pointer to a spinner object [milliseconds] 142 | */ 143 | uint16_t lv_spinner_get_spin_time(const lv_obj_t * spinner); 144 | 145 | /** 146 | * Get the animation type of a spinner. 147 | * @param spinner pointer to spinner object 148 | * @return animation type 149 | * */ 150 | lv_spinner_type_t lv_spinner_get_type(lv_obj_t * spinner); 151 | 152 | /** 153 | * Get the animation direction of a spinner 154 | * @param spinner pointer to spinner object 155 | * @return animation direction 156 | */ 157 | lv_spinner_dir_t lv_spinner_get_dir(lv_obj_t * spinner); 158 | 159 | /*===================== 160 | * Other functions 161 | *====================*/ 162 | 163 | /** 164 | * Animator function (exec_cb) to rotate the arc of spinner. 165 | * @param ptr pointer to spinner 166 | * @param val the current desired value [0..360] 167 | */ 168 | void lv_spinner_anim_cb(void * ptr, lv_anim_value_t val); 169 | 170 | /********************** 171 | * MACROS 172 | **********************/ 173 | 174 | #endif /*LV_USE_SPINNER*/ 175 | 176 | #ifdef __cplusplus 177 | } /* extern "C" */ 178 | #endif 179 | 180 | #endif /*LV_SPINNER_H*/ 181 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_switch.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_sw.h 3 | * 4 | */ 5 | 6 | #ifndef LV_SWITCH_H 7 | #define LV_SWITCH_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_SWITCH != 0 19 | 20 | /*Testing of dependencies*/ 21 | #if LV_USE_SLIDER == 0 22 | #error "lv_sw: lv_slider is required. Enable it in lv_conf.h (LV_USE_SLIDER 1)" 23 | #endif 24 | 25 | #include "../lv_core/lv_obj.h" 26 | #include "lv_bar.h" 27 | 28 | /********************* 29 | * DEFINES 30 | *********************/ 31 | 32 | /********************** 33 | * TYPEDEFS 34 | **********************/ 35 | /*Data of switch*/ 36 | typedef struct { 37 | lv_bar_ext_t bar; /*Ext. of ancestor*/ 38 | /*New data for this type */ 39 | lv_style_list_t style_knob; /*Style of the knob*/ 40 | } lv_switch_ext_t; 41 | 42 | /** 43 | * Switch parts. 44 | */ 45 | enum { 46 | LV_SWITCH_PART_BG = LV_BAR_PART_BG, /**< Switch background. */ 47 | LV_SWITCH_PART_INDIC = LV_BAR_PART_INDIC, /**< Switch fill area. */ 48 | LV_SWITCH_PART_KNOB = _LV_BAR_PART_VIRTUAL_LAST, /**< Switch knob. */ 49 | _LV_SWITCH_PART_VIRTUAL_LAST 50 | }; 51 | 52 | typedef uint8_t lv_switch_part_t; 53 | 54 | /********************** 55 | * GLOBAL PROTOTYPES 56 | **********************/ 57 | 58 | /** 59 | * Create a switch objects 60 | * @param par pointer to an object, it will be the parent of the new switch 61 | * @param copy pointer to a switch object, if not NULL then the new object will be copied from it 62 | * @return pointer to the created switch 63 | */ 64 | lv_obj_t * lv_switch_create(lv_obj_t * par, const lv_obj_t * copy); 65 | 66 | /*===================== 67 | * Setter functions 68 | *====================*/ 69 | 70 | /** 71 | * Turn ON the switch 72 | * @param sw pointer to a switch object 73 | * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately 74 | */ 75 | void lv_switch_on(lv_obj_t * sw, lv_anim_enable_t anim); 76 | 77 | /** 78 | * Turn OFF the switch 79 | * @param sw pointer to a switch object 80 | * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately 81 | */ 82 | void lv_switch_off(lv_obj_t * sw, lv_anim_enable_t anim); 83 | 84 | /** 85 | * Toggle the position of the switch 86 | * @param sw pointer to a switch object 87 | * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately 88 | * @return resulting state of the switch. 89 | */ 90 | bool lv_switch_toggle(lv_obj_t * sw, lv_anim_enable_t anim); 91 | 92 | /** 93 | * Set the animation time of the switch 94 | * @param sw pointer to a switch object 95 | * @param anim_time animation time 96 | * @return style pointer to a style 97 | */ 98 | static inline void lv_switch_set_anim_time(lv_obj_t * sw, uint16_t anim_time) 99 | { 100 | lv_bar_set_anim_time(sw, anim_time); 101 | } 102 | 103 | /*===================== 104 | * Getter functions 105 | *====================*/ 106 | 107 | /** 108 | * Get the state of a switch 109 | * @param sw pointer to a switch object 110 | * @return false: OFF; true: ON 111 | */ 112 | static inline bool lv_switch_get_state(const lv_obj_t * sw) 113 | { 114 | return lv_bar_get_value(sw) == 1 ? true : false; 115 | } 116 | 117 | /** 118 | * Get the animation time of the switch 119 | * @param sw pointer to a switch object 120 | * @return style pointer to a style 121 | */ 122 | static inline uint16_t lv_switch_get_anim_time(const lv_obj_t * sw) 123 | { 124 | return lv_bar_get_anim_time(sw); 125 | } 126 | 127 | /********************** 128 | * MACROS 129 | **********************/ 130 | 131 | #endif /*LV_USE_SWITCH*/ 132 | 133 | #ifdef __cplusplus 134 | } /* extern "C" */ 135 | #endif 136 | 137 | #endif /*LV_SWITCH_H*/ 138 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_tabview.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_tabview.h 3 | * 4 | */ 5 | 6 | #ifndef LV_TABVIEW_H 7 | #define LV_TABVIEW_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_TABVIEW != 0 19 | 20 | /*Testing of dependencies*/ 21 | #if LV_USE_BTNMATRIX == 0 22 | #error "lv_tabview: lv_btnm is required. Enable it in lv_conf.h (LV_USE_BTNMATRIX 1) " 23 | #endif 24 | 25 | #if LV_USE_PAGE == 0 26 | #error "lv_tabview: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) " 27 | #endif 28 | 29 | #include "../lv_core/lv_obj.h" 30 | #include "../lv_widgets/lv_win.h" 31 | #include "../lv_widgets/lv_page.h" 32 | 33 | /********************* 34 | * DEFINES 35 | *********************/ 36 | 37 | /********************** 38 | * TYPEDEFS 39 | **********************/ 40 | 41 | /** Position of tabview buttons. */ 42 | enum { 43 | LV_TABVIEW_TAB_POS_NONE, 44 | LV_TABVIEW_TAB_POS_TOP, 45 | LV_TABVIEW_TAB_POS_BOTTOM, 46 | LV_TABVIEW_TAB_POS_LEFT, 47 | LV_TABVIEW_TAB_POS_RIGHT 48 | }; 49 | typedef uint8_t lv_tabview_btns_pos_t; 50 | 51 | /*Data of tab*/ 52 | typedef struct { 53 | /*Ext. of ancestor*/ 54 | /*New data for this type */ 55 | lv_obj_t * btns; 56 | lv_obj_t * indic; 57 | lv_obj_t * content; /*A background page which holds tab's pages*/ 58 | const char ** tab_name_ptr; 59 | lv_point_t point_last; 60 | uint16_t tab_cur; 61 | uint16_t tab_cnt; 62 | #if LV_USE_ANIMATION 63 | uint16_t anim_time; 64 | #endif 65 | lv_tabview_btns_pos_t btns_pos : 3; 66 | } lv_tabview_ext_t; 67 | 68 | enum { 69 | LV_TABVIEW_PART_BG = LV_OBJ_PART_MAIN, 70 | _LV_TABVIEW_PART_VIRTUAL_LAST = _LV_OBJ_PART_VIRTUAL_LAST, 71 | 72 | LV_TABVIEW_PART_BG_SCRLLABLE = _LV_OBJ_PART_REAL_LAST, 73 | LV_TABVIEW_PART_TAB_BG, 74 | LV_TABVIEW_PART_TAB_BTN, 75 | LV_TABVIEW_PART_INDIC, 76 | _LV_TABVIEW_PART_REAL_LAST, 77 | }; 78 | typedef uint8_t lv_tabview_part_t; 79 | 80 | /********************** 81 | * GLOBAL PROTOTYPES 82 | **********************/ 83 | 84 | /** 85 | * Create a Tab view object 86 | * @param par pointer to an object, it will be the parent of the new tab 87 | * @param copy pointer to a tab object, if not NULL then the new object will be copied from it 88 | * @return pointer to the created tab 89 | */ 90 | lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy); 91 | 92 | /*====================== 93 | * Add/remove functions 94 | *=====================*/ 95 | 96 | /** 97 | * Add a new tab with the given name 98 | * @param tabview pointer to Tab view object where to ass the new tab 99 | * @param name the text on the tab button 100 | * @return pointer to the created page object (lv_page). You can create your content here 101 | */ 102 | lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name); 103 | 104 | /** 105 | * Delete all children of a tab created by `lv_tabview_add_tab`. 106 | * @param tab pointer to a tab 107 | */ 108 | void lv_tabview_clean_tab(lv_obj_t * tab); 109 | 110 | /*===================== 111 | * Setter functions 112 | *====================*/ 113 | 114 | /** 115 | * Set a new tab 116 | * @param tabview pointer to Tab view object 117 | * @param id index of a tab to load 118 | * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately 119 | */ 120 | void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t anim); 121 | 122 | /** 123 | * Set the name of a tab. 124 | * @param tabview pointer to Tab view object 125 | * @param id index of the tab the name should be set 126 | * @param name new tab name 127 | */ 128 | void lv_tabview_set_tab_name(lv_obj_t * tabview, uint16_t id, char * name); 129 | 130 | /** 131 | * Set the animation time of tab view when a new tab is loaded 132 | * @param tabview pointer to Tab view object 133 | * @param anim_time time of animation in milliseconds 134 | */ 135 | void lv_tabview_set_anim_time(lv_obj_t * tabview, uint16_t anim_time); 136 | 137 | /** 138 | * Set the position of tab select buttons 139 | * @param tabview pointer to a tab view object 140 | * @param btns_pos which button position 141 | */ 142 | void lv_tabview_set_btns_pos(lv_obj_t * tabview, lv_tabview_btns_pos_t btns_pos); 143 | 144 | /*===================== 145 | * Getter functions 146 | *====================*/ 147 | 148 | /** 149 | * Get the index of the currently active tab 150 | * @param tabview pointer to Tab view object 151 | * @return the active tab index 152 | */ 153 | uint16_t lv_tabview_get_tab_act(const lv_obj_t * tabview); 154 | 155 | /** 156 | * Get the number of tabs 157 | * @param tabview pointer to Tab view object 158 | * @return tab count 159 | */ 160 | uint16_t lv_tabview_get_tab_count(const lv_obj_t * tabview); 161 | /** 162 | * Get the page (content area) of a tab 163 | * @param tabview pointer to Tab view object 164 | * @param id index of the tab (>= 0) 165 | * @return pointer to page (lv_page) object 166 | */ 167 | lv_obj_t * lv_tabview_get_tab(const lv_obj_t * tabview, uint16_t id); 168 | 169 | /** 170 | * Get the animation time of tab view when a new tab is loaded 171 | * @param tabview pointer to Tab view object 172 | * @return time of animation in milliseconds 173 | */ 174 | uint16_t lv_tabview_get_anim_time(const lv_obj_t * tabview); 175 | 176 | /** 177 | * Get position of tab select buttons 178 | * @param tabview pointer to a ab view object 179 | */ 180 | lv_tabview_btns_pos_t lv_tabview_get_btns_pos(const lv_obj_t * tabview); 181 | 182 | /********************** 183 | * MACROS 184 | **********************/ 185 | 186 | #endif /*LV_USE_TABVIEW*/ 187 | 188 | #ifdef __cplusplus 189 | } /* extern "C" */ 190 | #endif 191 | 192 | #endif /*LV_TABVIEW_H*/ 193 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_tileview.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_tileview.h 3 | * 4 | */ 5 | 6 | #ifndef LV_TILEVIEW_H 7 | #define LV_TILEVIEW_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /********************* 14 | * INCLUDES 15 | *********************/ 16 | #include "../lv_conf_internal.h" 17 | 18 | #if LV_USE_TILEVIEW != 0 19 | 20 | #include "../lv_widgets/lv_page.h" 21 | 22 | /********************* 23 | * DEFINES 24 | *********************/ 25 | 26 | /********************** 27 | * TYPEDEFS 28 | **********************/ 29 | 30 | /*Data of tileview*/ 31 | typedef struct { 32 | lv_page_ext_t page; 33 | /*New data for this type */ 34 | const lv_point_t * valid_pos; 35 | uint16_t valid_pos_cnt; 36 | #if LV_USE_ANIMATION 37 | uint16_t anim_time; 38 | #endif 39 | lv_point_t act_id; 40 | uint8_t drag_top_en : 1; 41 | uint8_t drag_bottom_en : 1; 42 | uint8_t drag_left_en : 1; 43 | uint8_t drag_right_en : 1; 44 | } lv_tileview_ext_t; 45 | 46 | /*Parts of the Tileview*/ 47 | enum { 48 | LV_TILEVIEW_PART_BG = LV_PAGE_PART_BG, 49 | LV_TILEVIEW_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR, 50 | LV_TILEVIEW_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, 51 | _LV_TILEVIEW_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST, 52 | _LV_TILEVIEW_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST 53 | }; 54 | 55 | /********************** 56 | * GLOBAL PROTOTYPES 57 | **********************/ 58 | 59 | /** 60 | * Create a tileview objects 61 | * @param par pointer to an object, it will be the parent of the new tileview 62 | * @param copy pointer to a tileview object, if not NULL then the new object will be copied from it 63 | * @return pointer to the created tileview 64 | */ 65 | lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy); 66 | 67 | /*====================== 68 | * Add/remove functions 69 | *=====================*/ 70 | 71 | /** 72 | * Register an object on the tileview. The register object will able to slide the tileview 73 | * @param tileview pointer to a Tileview object 74 | * @param element pointer to an object 75 | */ 76 | void lv_tileview_add_element(lv_obj_t * tileview, lv_obj_t * element); 77 | 78 | /*===================== 79 | * Setter functions 80 | *====================*/ 81 | 82 | /** 83 | * Set the valid position's indices. The scrolling will be possible only to these positions. 84 | * @param tileview pointer to a Tileview object 85 | * @param valid_pos array width the indices. E.g. `lv_point_t p[] = {{0,0}, {1,0}, {1,1}`. 86 | * Only the pointer is saved so can't be a local variable. 87 | * @param valid_pos_cnt number of elements in `valid_pos` array 88 | */ 89 | void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t valid_pos[], uint16_t valid_pos_cnt); 90 | 91 | /** 92 | * Set the tile to be shown 93 | * @param tileview pointer to a tileview object 94 | * @param x column id (0, 1, 2...) 95 | * @param y line id (0, 1, 2...) 96 | * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately 97 | */ 98 | void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim); 99 | 100 | /** 101 | * Enable the edge flash effect. (Show an arc when the an edge is reached) 102 | * @param tileview pointer to a Tileview 103 | * @param en true or false to enable/disable end flash 104 | */ 105 | static inline void lv_tileview_set_edge_flash(lv_obj_t * tileview, bool en) 106 | { 107 | lv_page_set_edge_flash(tileview, en); 108 | } 109 | 110 | /** 111 | * Set the animation time for the Tile view 112 | * @param tileview pointer to a page object 113 | * @param anim_time animation time in milliseconds 114 | */ 115 | static inline void lv_tileview_set_anim_time(lv_obj_t * tileview, uint16_t anim_time) 116 | { 117 | lv_page_set_anim_time(tileview, anim_time); 118 | } 119 | 120 | /*===================== 121 | * Getter functions 122 | *====================*/ 123 | /** 124 | * Get the tile to be shown 125 | * @param tileview pointer to a tileview object 126 | * @param x column id (0, 1, 2...) 127 | * @param y line id (0, 1, 2...) 128 | */ 129 | void lv_tileview_get_tile_act(lv_obj_t * tileview, lv_coord_t * x, lv_coord_t * y); 130 | /** 131 | * Get the scroll propagation property 132 | * @param tileview pointer to a Tileview 133 | * @return true or false 134 | */ 135 | static inline bool lv_tileview_get_edge_flash(lv_obj_t * tileview) 136 | { 137 | return lv_page_get_edge_flash(tileview); 138 | } 139 | 140 | /** 141 | * Get the animation time for the Tile view 142 | * @param tileview pointer to a page object 143 | * @return animation time in milliseconds 144 | */ 145 | static inline uint16_t lv_tileview_get_anim_time(lv_obj_t * tileview) 146 | { 147 | return lv_page_get_anim_time(tileview); 148 | } 149 | 150 | /*===================== 151 | * Other functions 152 | *====================*/ 153 | 154 | /********************** 155 | * MACROS 156 | **********************/ 157 | 158 | #endif /*LV_USE_TILEVIEW*/ 159 | 160 | #ifdef __cplusplus 161 | } /* extern "C" */ 162 | #endif 163 | 164 | #endif /*LV_TILEVIEW_H*/ 165 | -------------------------------------------------------------------------------- /lvgl/lv_widgets/lv_widgets.mk: -------------------------------------------------------------------------------- 1 | CSRCS += lv_arc.c 2 | CSRCS += lv_bar.c 3 | CSRCS += lv_checkbox.c 4 | CSRCS += lv_cpicker.c 5 | CSRCS += lv_dropdown.c 6 | CSRCS += lv_keyboard.c 7 | CSRCS += lv_line.c 8 | CSRCS += lv_msgbox.c 9 | CSRCS += lv_spinner.c 10 | CSRCS += lv_roller.c 11 | CSRCS += lv_table.c 12 | CSRCS += lv_tabview.c 13 | CSRCS += lv_tileview.c 14 | CSRCS += lv_btn.c 15 | CSRCS += lv_calendar.c 16 | CSRCS += lv_chart.c 17 | CSRCS += lv_canvas.c 18 | CSRCS += lv_gauge.c 19 | CSRCS += lv_label.c 20 | CSRCS += lv_list.c 21 | CSRCS += lv_slider.c 22 | CSRCS += lv_textarea.c 23 | CSRCS += lv_spinbox.c 24 | CSRCS += lv_btnmatrix.c 25 | CSRCS += lv_cont.c 26 | CSRCS += lv_img.c 27 | CSRCS += lv_imgbtn.c 28 | CSRCS += lv_led.c 29 | CSRCS += lv_linemeter.c 30 | CSRCS += lv_page.c 31 | CSRCS += lv_switch.c 32 | CSRCS += lv_win.c 33 | CSRCS += lv_objmask.c 34 | 35 | DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_widgets 36 | VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_widgets 37 | 38 | CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_widgets" 39 | -------------------------------------------------------------------------------- /lvgl/lvgl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lvgl.h 3 | * Include all LittleV GL related headers 4 | */ 5 | 6 | #ifndef LVGL_H 7 | #define LVGL_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | 14 | /*************************** 15 | * CURRENT VERSION OF LVGL 16 | ***************************/ 17 | #define LVGL_VERSION_MAJOR 7 18 | #define LVGL_VERSION_MINOR 7 19 | #define LVGL_VERSION_PATCH 1 20 | #define LVGL_VERSION_INFO "" 21 | 22 | /********************* 23 | * INCLUDES 24 | *********************/ 25 | 26 | #include "lv_misc/lv_log.h" 27 | #include "lv_misc/lv_task.h" 28 | #include "lv_misc/lv_math.h" 29 | #include "lv_misc/lv_async.h" 30 | #include "lv_misc/lv_gc.h" 31 | 32 | #include "lv_hal/lv_hal.h" 33 | 34 | #include "lv_core/lv_obj.h" 35 | #include "lv_core/lv_group.h" 36 | #include "lv_core/lv_indev.h" 37 | 38 | #include "lv_core/lv_refr.h" 39 | #include "lv_core/lv_disp.h" 40 | 41 | #include "lv_themes/lv_theme.h" 42 | 43 | #include "lv_font/lv_font.h" 44 | #include "lv_font/lv_font_loader.h" 45 | #include "lv_font/lv_font_fmt_txt.h" 46 | #include "lv_misc/lv_printf.h" 47 | 48 | #include "lv_widgets/lv_btn.h" 49 | #include "lv_widgets/lv_imgbtn.h" 50 | #include "lv_widgets/lv_img.h" 51 | #include "lv_widgets/lv_label.h" 52 | #include "lv_widgets/lv_line.h" 53 | #include "lv_widgets/lv_page.h" 54 | #include "lv_widgets/lv_cont.h" 55 | #include "lv_widgets/lv_list.h" 56 | #include "lv_widgets/lv_chart.h" 57 | #include "lv_widgets/lv_table.h" 58 | #include "lv_widgets/lv_checkbox.h" 59 | #include "lv_widgets/lv_cpicker.h" 60 | #include "lv_widgets/lv_bar.h" 61 | #include "lv_widgets/lv_slider.h" 62 | #include "lv_widgets/lv_led.h" 63 | #include "lv_widgets/lv_btnmatrix.h" 64 | #include "lv_widgets/lv_keyboard.h" 65 | #include "lv_widgets/lv_dropdown.h" 66 | #include "lv_widgets/lv_roller.h" 67 | #include "lv_widgets/lv_textarea.h" 68 | #include "lv_widgets/lv_canvas.h" 69 | #include "lv_widgets/lv_win.h" 70 | #include "lv_widgets/lv_tabview.h" 71 | #include "lv_widgets/lv_tileview.h" 72 | #include "lv_widgets/lv_msgbox.h" 73 | #include "lv_widgets/lv_objmask.h" 74 | #include "lv_widgets/lv_gauge.h" 75 | #include "lv_widgets/lv_linemeter.h" 76 | #include "lv_widgets/lv_switch.h" 77 | #include "lv_widgets/lv_arc.h" 78 | #include "lv_widgets/lv_spinner.h" 79 | #include "lv_widgets/lv_calendar.h" 80 | #include "lv_widgets/lv_spinbox.h" 81 | 82 | #include "lv_draw/lv_img_cache.h" 83 | 84 | #include "lv_api_map.h" 85 | 86 | //#define LV_BUILD_TEST 1 87 | 88 | /********************* 89 | * DEFINES 90 | *********************/ 91 | 92 | /********************** 93 | * TYPEDEFS 94 | **********************/ 95 | 96 | /********************** 97 | * GLOBAL PROTOTYPES 98 | **********************/ 99 | 100 | /********************** 101 | * MACROS 102 | **********************/ 103 | 104 | /** Gives 1 if the x.y.z version is supported in the current version 105 | * Usage: 106 | * 107 | * - Require v6 108 | * #if LV_VERSION_CHECK(6,0,0) 109 | * new_func_in_v6(); 110 | * #endif 111 | * 112 | * 113 | * - Require at least v5.3 114 | * #if LV_VERSION_CHECK(5,3,0) 115 | * new_feature_from_v5_3(); 116 | * #endif 117 | * 118 | * 119 | * - Require v5.3.2 bugfixes 120 | * #if LV_VERSION_CHECK(5,3,2) 121 | * bugfix_in_v5_3_2(); 122 | * #endif 123 | * 124 | * */ 125 | #define LV_VERSION_CHECK(x,y,z) (x == LVGL_VERSION_MAJOR && (y < LVGL_VERSION_MINOR || (y == LVGL_VERSION_MINOR && z <= LVGL_VERSION_PATCH))) 126 | 127 | 128 | #ifdef __cplusplus 129 | } 130 | #endif 131 | 132 | #endif /*LVGL_H*/ 133 | -------------------------------------------------------------------------------- /tools/pkg_scons: -------------------------------------------------------------------------------- 1 | import os 2 | from building import * 3 | 4 | objs = [] 5 | cwd = GetCurrentDir() 6 | list = os.listdir(cwd) 7 | 8 | for item in list: 9 | if os.path.isfile(os.path.join(cwd, item, 'SConscript')): 10 | objs = objs + SConscript(os.path.join(item, 'SConscript')) 11 | 12 | Return('objs') 13 | --------------------------------------------------------------------------------