working lcd small quer

This commit is contained in:
2024-06-21 17:24:06 +02:00
commit bd9ac0409a
936 changed files with 422571 additions and 0 deletions

View File

@ -0,0 +1,187 @@
# Option to define LV_LVGL_H_INCLUDE_SIMPLE, default: ON
option(LV_LVGL_H_INCLUDE_SIMPLE
"Use #include \"lvgl.h\" instead of #include \"../../lvgl.h\"" ON)
# Option to define LV_CONF_INCLUDE_SIMPLE, default: ON
option(LV_CONF_INCLUDE_SIMPLE
"Use #include \"lv_conf.h\" instead of #include \"../../lv_conf.h\"" ON)
# Option LV_CONF_PATH, which should be the path for lv_conf.h
# If set parent path LV_CONF_DIR is added to includes
if( LV_CONF_PATH )
get_filename_component(LV_CONF_DIR ${LV_CONF_PATH} DIRECTORY)
endif( LV_CONF_PATH )
# Option to build shared libraries (as opposed to static), default: OFF
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
# Set sources used for LVGL components
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c ${LVGL_ROOT_DIR}/src/*.S)
file(GLOB_RECURSE EXAMPLE_SOURCES ${LVGL_ROOT_DIR}/examples/*.c)
file(GLOB_RECURSE DEMO_SOURCES ${LVGL_ROOT_DIR}/demos/*.c)
file(GLOB_RECURSE THORVG_SOURCES ${LVGL_ROOT_DIR}/src/libs/thorvg/*.cpp ${LVGL_ROOT_DIR}/src/others/vg_lite_tvg/*.cpp)
# Build LVGL library
add_library(lvgl ${SOURCES})
add_library(lvgl::lvgl ALIAS lvgl)
target_compile_definitions(
lvgl PUBLIC $<$<BOOL:${LV_LVGL_H_INCLUDE_SIMPLE}>:LV_LVGL_H_INCLUDE_SIMPLE>
$<$<BOOL:${LV_CONF_INCLUDE_SIMPLE}>:LV_CONF_INCLUDE_SIMPLE>
$<$<COMPILE_LANGUAGE:ASM>:__ASSEMBLY__>)
# Add definition of LV_CONF_PATH only if needed
if(LV_CONF_PATH)
target_compile_definitions(lvgl PUBLIC LV_CONF_PATH=${LV_CONF_PATH})
endif()
# Add definition of LV_CONF_SKIP only if needed
if(LV_CONF_SKIP)
target_compile_definitions(lvgl PUBLIC LV_CONF_SKIP=1)
endif()
# Include root and optional parent path of LV_CONF_PATH
target_include_directories(lvgl SYSTEM PUBLIC ${LVGL_ROOT_DIR} ${LV_CONF_DIR})
if(NOT LV_CONF_BUILD_DISABLE_THORVG_INTERNAL)
add_library(lvgl_thorvg ${THORVG_SOURCES})
add_library(lvgl::thorvg ALIAS lvgl_thorvg)
target_include_directories(lvgl_thorvg SYSTEM PUBLIC ${LVGL_ROOT_DIR}/src/libs/thorvg)
target_link_libraries(lvgl_thorvg PUBLIC lvgl)
endif()
# Build LVGL example library
if(NOT LV_CONF_BUILD_DISABLE_EXAMPLES)
add_library(lvgl_examples ${EXAMPLE_SOURCES})
add_library(lvgl::examples ALIAS lvgl_examples)
target_include_directories(lvgl_examples SYSTEM PUBLIC ${LVGL_ROOT_DIR}/examples)
target_link_libraries(lvgl_examples PUBLIC lvgl)
endif()
# Build LVGL demos library
if(NOT LV_CONF_BUILD_DISABLE_DEMOS)
add_library(lvgl_demos ${DEMO_SOURCES})
add_library(lvgl::demos ALIAS lvgl_demos)
target_include_directories(lvgl_demos SYSTEM PUBLIC ${LVGL_ROOT_DIR}/demos)
target_link_libraries(lvgl_demos PUBLIC lvgl)
endif()
# Lbrary and headers can be installed to system using make install
file(GLOB LVGL_PUBLIC_HEADERS "${CMAKE_SOURCE_DIR}/lv_conf.h"
"${CMAKE_SOURCE_DIR}/lvgl.h")
if("${LIB_INSTALL_DIR}" STREQUAL "")
set(LIB_INSTALL_DIR "lib")
endif()
if("${RUNTIME_INSTALL_DIR}" STREQUAL "")
set(RUNTIME_INSTALL_DIR "bin")
endif()
if("${INC_INSTALL_DIR}" STREQUAL "")
set(INC_INSTALL_DIR "include/lvgl")
endif()
#Install headers
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/"
FILES_MATCHING
PATTERN "*.h")
# install example headers
if(NOT LV_CONF_BUILD_DISABLE_EXAMPLES)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/examples"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/"
FILES_MATCHING
PATTERN "*.h")
endif()
# install demo headers
if(NOT LV_CONF_BUILD_DISABLE_DEMOS)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/demos"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/"
FILES_MATCHING
PATTERN "*.h")
endif()
configure_file("${LVGL_ROOT_DIR}/lvgl.pc.in" lvgl.pc @ONLY)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc"
DESTINATION "${LIB_INSTALL_DIR}/pkgconfig/")
# Install library
set_target_properties(
lvgl
PROPERTIES OUTPUT_NAME lvgl
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
install(
TARGETS lvgl
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
# Install library thorvg
if(NOT LV_CONF_BUILD_DISABLE_THORVG_INTERNAL)
set_target_properties(
lvgl_thorvg
PROPERTIES OUTPUT_NAME lvgl_thorvg
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
install(
TARGETS lvgl_thorvg
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
endif()
# Install library demos
if(NOT LV_CONF_BUILD_DISABLE_DEMOS)
set_target_properties(
lvgl_demos
PROPERTIES OUTPUT_NAME lvgl_demos
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
install(
TARGETS lvgl_demos
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
endif()
#install library examples
if(NOT LV_CONF_BUILD_DISABLE_EXAMPLES)
set_target_properties(
lvgl_examples
PROPERTIES OUTPUT_NAME lvgl_examples
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
install(
TARGETS lvgl_examples
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
RUNTIME DESTINATION "${RUNTIME_INSTALL_DIR}"
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
endif()

View File

@ -0,0 +1,54 @@
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c ${LVGL_ROOT_DIR}/src/*.cpp)
idf_build_get_property(LV_MICROPYTHON LV_MICROPYTHON)
if(LV_MICROPYTHON)
idf_component_register(
SRCS
${SOURCES}
INCLUDE_DIRS
${LVGL_ROOT_DIR}
${LVGL_ROOT_DIR}/src
${LVGL_ROOT_DIR}/../
REQUIRES
main)
else()
if(CONFIG_LV_BUILD_EXAMPLES)
file(GLOB_RECURSE EXAMPLE_SOURCES ${LVGL_ROOT_DIR}/examples/*.c)
set_source_files_properties(${EXAMPLE_SOURCES} COMPILE_FLAGS "-Wno-unused-variable -Wno-format")
endif()
if(CONFIG_LV_USE_DEMO_WIDGETS)
file(GLOB_RECURSE DEMO_WIDGETS_SOURCES ${LVGL_ROOT_DIR}/demos/widgets/*.c)
list(APPEND DEMO_SOURCES ${DEMO_WIDGETS_SOURCES})
endif()
if(CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER)
file(GLOB_RECURSE DEMO_KEYPAD_AND_ENCODER_SOURCES ${LVGL_ROOT_DIR}/demos/keypad_encoder/*.c)
list(APPEND DEMO_SOURCES ${DEMO_KEYPAD_AND_ENCODER_SOURCES})
endif()
if(CONFIG_LV_USE_DEMO_BENCHMARK)
file(GLOB_RECURSE DEMO_BENCHMARK_SOURCES ${LVGL_ROOT_DIR}/demos/benchmark/*.c)
list(APPEND DEMO_SOURCES ${DEMO_BENCHMARK_SOURCES})
endif()
if(CONFIG_LV_USE_DEMO_STRESS)
file(GLOB_RECURSE DEMO_STRESS_SOURCES ${LVGL_ROOT_DIR}/demos/stress/*.c)
list(APPEND DEMO_SOURCES ${DEMO_STRESS_SOURCES})
endif()
if(CONFIG_LV_USE_DEMO_MUSIC)
file(GLOB_RECURSE DEMO_MUSIC_SOURCES ${LVGL_ROOT_DIR}/demos/music/*.c)
list(APPEND DEMO_SOURCES ${DEMO_MUSIC_SOURCES})
set_source_files_properties(${DEMO_MUSIC_SOURCES} COMPILE_FLAGS "-Wno-format")
endif()
idf_component_register(SRCS ${SOURCES} ${EXAMPLE_SOURCES} ${DEMO_SOURCES}
INCLUDE_DIRS ${LVGL_ROOT_DIR} ${LVGL_ROOT_DIR}/src ${LVGL_ROOT_DIR}/../
${LVGL_ROOT_DIR}/examples ${LVGL_ROOT_DIR}/demos
REQUIRES esp_timer)
endif()
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_CONF_INCLUDE_SIMPLE")
if(CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM)
target_compile_definitions(${COMPONENT_LIB}
PUBLIC "-DLV_ATTRIBUTE_FAST_MEM=IRAM_ATTR")
endif()

View File

@ -0,0 +1,18 @@
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c)
file(GLOB_RECURSE EXAMPLE_SOURCES ${LVGL_ROOT_DIR}/examples/*.c)
# With micropython, build lvgl as interface library, link chain is:
# lvgl_interface [lvgl] → usermod_lvgl_bindings [lv_bindings] → usermod
# [micropython] → firmware [micropython]
add_library(lvgl_interface INTERFACE)
# ${SOURCES} must NOT be given to add_library directly for some reason (won't be
# built)
target_sources(lvgl_interface INTERFACE ${SOURCES})
# Micropython builds with -Werror; we need to suppress some warnings, such as:
#
# /home/test/build/lv_micropython/ports/rp2/build-PICO/lv_mp.c:29316:16: error:
# 'lv_style_transition_dsc_t_path_xcb_callback' defined but not used
# [-Werror=unused-function] 29316 | STATIC int32_t
# lv_style_transition_dsc_t_path_xcb_callback(const lv_anim_t * arg0) |
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target_compile_options(lvgl_interface INTERFACE -Wno-unused-function)

View File

@ -0,0 +1,14 @@
if(CONFIG_LVGL)
zephyr_include_directories(${ZEPHYR_BASE}/lib/gui/lvgl)
target_include_directories(lvgl INTERFACE ${LVGL_ROOT_DIR})
zephyr_compile_definitions(LV_CONF_KCONFIG_EXTERNAL_INCLUDE=<autoconf.h>)
zephyr_library()
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c)
zephyr_library_sources(${SOURCES})
endif(CONFIG_LVGL)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<index schemaVersion="1.0.0" xs:noNamespaceSchemaLocation="PackIndex.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<vendor>LVGL</vendor>
<url>https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/</url>
<timestamp>2024-03-19</timestamp>
<pindex>
<pdsc url="https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/" vendor="LVGL" name="lvgl" version="9.1.0"/>
</pindex>
</index>

View File

@ -0,0 +1,269 @@
# How to Create CMSIS-Pack
## STEP 1 Update 'lv_conf_cmsis.h'
1. Copy the **lv_conf_template.h** to '**cmsis-pack**' directory
2. Set the macro protector to '1'
```c
...
/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
...
```
remove the misleading guide above this code segment.
```c
/*
* Copy this file as `lv_conf.h`
* 1. simply next to the `lvgl` folder
* 2. or any other places and
* - define `LV_CONF_INCLUDE_SIMPLE`
* - add the path as include path
*/
```
3. Add including for '**RTE_Components.h**'
```c
#ifndef LV_CONF_H
#define LV_CONF_H
#include "RTE_Components.h"
...
```
4. Remove macro definitions for
- LV_USE_DEMO_WIDGETS
- LV_USE_DEMO_BENCHMARK
- LV_USE_IME_PINYIN
- LV_USE_OS
- LV_USE_FILE_EXPLORER
- LV_USE_DEMO_WIDGETS
- LV_USE_DEMO_KEYPAD_AND_ENCODER
- LV_USE_DEMO_BENCHMARK
- LV_USE_DEMO_RENDER
- LV_USE_DEMO_STRESS
- LV_USE_DEMO_MUSIC
- LV_USE_DEMO_FLEX_LAYOUT
- LV_USE_DEMO_MULTILANG
- LV_USE_DEMO_TRANSFORM
- LV_USE_DEMO_SCROLL
- LV_USE_DEMO_VECTOR_GRAPHIC
- LV_USE_DRAW_VGLITE
- LV_USE_DRAW_VG_LITE
- LV_USE_DRAW_PXP
- LV_USE_DRAW_SDL
- LV_USE_DRAW_ARM2D
- LV_USE_SNAPSHOT
- LV_USE_MONKEY
- LV_USE_GRIDNAV
- LV_USE_FRAGMENT
- LV_USE_IMGFONT
- LV_USE_LINUX_DRM
- LV_USE_TFT_ESPI
- LV_USE_ST7735
- LV_USE_ST7789
- LV_USE_ST7796
- LV_USE_ILI9341
5. Update `LV_LOG_PRINTF` to `1` and `LV_LOG_LEVEL` to `LV_LOG_LEVEL_USER`
6. Set `LV_FONT_MONTSERRAT_12`, `LV_FONT_MONTSERRAT_24` and `LV_FONT_MONTSERRAT_16` to `1` (So Widgets and Benchmark can be compiled correctly, this is for improving the out of box experience.)
7. Update macro `LV_ATTRIBUTE_MEM_ALIGN` and `LV_ATTRIBUTE_MEM_ALIGN_SIZE` to force a WORD alignment.
```c
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1
#define LV_DRAW_BUF_STRIDE_ALIGN 4
#define LV_ATTRIBUTE_MEM_ALIGN __attribute__((aligned(4)))
```
Make sure `LV_MEM_SIZE` is no less than `(128*1024U)`.
8. Remove following macro definitions in the `3rd party libraries` section:
- \#define LV_USE_FS_STDIO 0
- \#define LV_USE_FS_POSIX 0
- \#define LV_USE_FS_WIN32 0
- \#define LV_USE_FS_FATFS 0
- #define LV_USE_FS_LITTLEFS 0
- #define LV_USE_FS_MEMFS 0
- \#define LV_USE_LODEPNG 0
- #define LV_USE_LIBPNG 0
- \#define LV_USE_BMP 0
- \#define LV_USE_RLE 0
- #define LV_USE_TJPGD 0
- #define LV_USE_LIBJPEG_TURBO 0
- \#define LV_USE_GIF 0
- \#define LV_USE_BARCODE 0
- \#define LV_USE_QRCODE 0
- \#define LV_USE_FREETYPE 0
- \#define LV_USE_TINY_TTF 0
- \#define LV_USE_RLOTTIE 0
- \#define LV_USE_FFMPEG 0
9. update the definition of following macros: `LV_USE_VECTOR_GRAPHIC`, `LV_USE_THORVE_INTERNAL` and `LV_USE_THORVE_EXTERNAL` as
```c
/*Enable Vector Graphic APIs*/
#ifndef LV_USE_VECTOR_GRAPHIC
# define LV_USE_VECTOR_GRAPHIC 0
/* Enable ThorVG (vector graphics library) from the src/libs folder */
# define LV_USE_THORVG_INTERNAL 0
/* Enable ThorVG by assuming that its installed and linked to the project */
# define LV_USE_THORVG_EXTERNAL 0
#endif
```
10. update the definition of following macros: `LV_USE_LZ4`, `LV_USE_LZ4_INTERNAL` and `LV_USE_LZ4_EXTERNAL` as
```c
/*Enable LZ4 compress/decompress lib*/
#ifndef LV_USE_LZ4
# define LV_USE_LZ4 0
/*Use lvgl built-in LZ4 lib*/
# define LV_USE_LZ4_INTERNAL 0
/*Use external LZ4 library*/
# define LV_USE_LZ4_EXTERNAL 0
#endif
```
11. Add the following code to `HAL SETTINGS`:
```c
/*customize tick-get */
#if defined(__PERF_COUNTER__) && __PERF_COUNTER__
#define LV_GLOBAL_INIT(__GLOBAL_PTR) \
do { \
lv_global_init((lv_global_t *)(__GLOBAL_PTR)); \
extern uint32_t perfc_tick_get(void); \
(__GLOBAL_PTR)->tick_state.tick_get_cb = perfc_tick_get; \
} while(0)
#endif
```
12. Replace the macro definition:
```c
#define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE
```
with:
```c
#if !defined(LV_USE_DRAW_SW_ASM) && defined(RTE_Acceleration_Arm_2D)
/*turn-on helium acceleration when Arm-2D and the Helium-powered device are detected */
#if defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE
#define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_HELIUM
#define LV_USE_DRAW_ARM2D 1
#endif
#endif
#ifndef LV_USE_DRAW_SW_ASM
#define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE
#endif
```
13. Update macro `LV_PROFILER_INCLUDE`:
```c
#define LV_PROFILER_INCLUDE "src/misc/lv_profiler_builtin.h"
```
14. rename '**lv_conf_template.h**' to '**lv_conf_cmsis.h**'.
## STEP 2 Check, Update and Run the 'gen_pack.sh'
```sh
if [ `uname -s` = "Linux" ]
then
CMSIS_PACK_PATH="/home/$USER/.arm/Packs/ARM/CMSIS/5.7.0/"
PATH_TO_ADD="$CMSIS_PACK_PATH/CMSIS/Utilities/Linux64/"
else
CMSIS_PACK_PATH="/C/Users/$USER/AppData/Local/Arm/Packs/ARM/CMSIS/5.7.0"
PATH_TO_ADD="/C/Program Files (x86)/7-Zip/:$CMSIS_PACK_PATH/CMSIS/Utilities/Win32/:/C/xmllint/"
fi
[[ ":$PATH:" != *":$PATH_TO_ADD}:"* ]] && PATH="${PATH}:${PATH_TO_ADD}"
echo $PATH_TO_ADD appended to PATH
echo " "
```
### A. For Windows users
Update the '**CMSIS_PACK_PATH**' accordingly (Usually just replace the name gabriel with your own windows account name is sufficient.).
Update the '**PATH_TO_ADD**' to point to the installation folders of **7Zip** and **xmllint**.
Launch the git-bash and go to the cmsis-pack folder.
enter the following command:
```sh
./gen_pack.sh
```
### B. For Linux Users
Update '**PATH_TO_ADD**' if necessary.
go to the **cmsis-pack** folder.
enter the following command:
```sh
./gen_pack.sh
```

View File

@ -0,0 +1,236 @@
#!/bin/bash
# Version: 1.1
# Date: 2022-01-11
# This bash script generates a CMSIS Software Pack:
#
# Pre-requisites:
# - bash shell (for Windows: install git for Windows)
# - 7z in path (zip archiving utility)
# e.g. Ubuntu: sudo apt-get install p7zip-full p7zip-rar)
# - PackChk in path with execute permission
# (see CMSIS-Pack: CMSIS/Utilities/<os>/PackChk)
# - xmllint in path (XML schema validation)
# e.g. Ubuntu: sudo apt-get install libxml2-utils
# Windows: download from https://www.zlatkovic.com/pub/libxml/
############### EDIT BELOW ###############
# Extend Path environment variable locally
#
if [ `uname -s` = "Linux" ]
then
CMSIS_PACK_PATH="/home/$USER/.arm/Packs/ARM/CMSIS/5.7.0/"
PATH_TO_ADD="$CMSIS_PACK_PATH/CMSIS/Utilities/Linux64/"
else
CMSIS_PACK_PATH="/C/Users/$USER/AppData/Local/Arm/Packs/ARM/CMSIS/5.7.0"
PATH_TO_ADD="/C/Program Files (x86)/7-Zip/:/C/Program Files/7-Zip/:$CMSIS_PACK_PATH/CMSIS/Utilities/Win32/:/C/xmllint/"
fi
[[ ":$PATH:" != *":$PATH_TO_ADD}:"* ]] && PATH="${PATH}:${PATH_TO_ADD}"
echo $PATH_TO_ADD appended to PATH
echo " "
# Pack warehouse directory - destination
PACK_WAREHOUSE=./
# Temporary pack build directory
PACK_BUILD=build/
# Specify directories included in pack relative to base directory
# All directories:
# PACK_DIRS=`ls -d */`
# Do not include the build directory if it is local
# PACK_DIRS=${PACK_DIRS//$PACK_BUILD/}
# PACK_DIRS=${PACK_DIRS//$PACK_WAREHOUSE/}
# alternative: specify directory names to be added to pack base directory
PACK_DIRS="
../../src
../../demos
../../env_support/pikascript
"
# Specify file names to be added to pack base directory
PACK_BASE_FILES="
../../LICENCE.txt
../../README.md
../../lvgl.h
lv_conf_cmsis.h
lv_cmsis_pack.txt
"
############ DO NOT EDIT BELOW ###########
echo Starting CMSIS-Pack Generation: `date`
# Zip utility check
ZIP=7z
type -a $ZIP
errorlevel=$?
if [ $errorlevel -gt 0 ]
then
echo "Error: No 7zip Utility found"
echo "Action: Add 7zip to your path"
echo " "
exit
fi
# Pack checking utility check
PACKCHK=PackChk
type -a $PACKCHK
errorlevel=$?
if [ $errorlevel != 0 ]
then
echo "Error: No PackChk Utility found"
echo "Action: Add PackChk to your path"
echo "Hint: Included in CMSIS Pack:"
echo "<pack_root_dir>/ARM/CMSIS/<version>/CMSIS/Utilities/<os>/"
echo " "
exit
fi
echo " "
# XML syntax checking utility check
XMLLINT=xmllint
type -a $XMLLINT
errorlevel=$?
if [ $errorlevel != 0 ]
then
echo "Error: No xmllint found"
echo "Action: Add xmllint to your path"
echo " "
exit
fi
echo " "
# Locate Package Description file
# check whether there is more than one pdsc file
NUM_PDSCS=`ls -1 *.pdsc | wc -l`
PACK_DESCRIPTION_FILE=`ls *.pdsc`
if [ $NUM_PDSCS -lt 1 ]
then
echo "Error: No *.pdsc file found in current directory"
echo " "
elif [ $NUM_PDSCS -gt 1 ]
then
echo "Error: Only one PDSC file allowed in directory structure:"
echo "Found:"
echo "$PACK_DESCRIPTION_FILE"
echo "Action: Delete unused pdsc files"
echo " "
exit
fi
SAVEIFS=$IFS
IFS=.
set $PACK_DESCRIPTION_FILE
# Pack Vendor
PACK_VENDOR=$1
# Pack Name
PACK_NAME=$2
echo Generating Pack Version: for $PACK_VENDOR.$PACK_NAME
echo " "
IFS=$SAVEIFS
#if $PACK_BUILD directory does not exist, create it.
if [ ! -d $PACK_BUILD ]; then
mkdir -p $PACK_BUILD
fi
mkdir -p ${PACK_BUILD}/examples
mkdir -p ${PACK_BUILD}/examples/porting
# directories
echo Adding directories to pack:
echo $PACK_DIRS
echo " "
for d in ${PACK_DIRS}
do
cp -r "$d" ${PACK_BUILD}
done
# files for base directory
echo Adding files to pack:
echo $PACK_BASE_FILES
echo " "
for f in $PACK_BASE_FILES
do
cp -f "$f" $PACK_BUILD/
done
# Copy files into build base directory: $PACK_BUILD
# pdsc file is mandatory in base directory:
cp -f ./$PACK_VENDOR.$PACK_NAME.pdsc ${PACK_BUILD}
cp -f ../../examples/porting/* ${PACK_BUILD}/examples/porting
cp -f ./lv_os_custom_c.txt ${PACK_BUILD}/src/osal/lv_os_custom.c
cp -f ./lv_os_custom_h.txt ${PACK_BUILD}/src/osal/lv_os_custom.h
mv "${PACK_BUILD}/lv_cmsis_pack.txt" "${PACK_BUILD}/lv_cmsis_pack.c"
# Run Schema Check (for Linux only):
# sudo apt-get install libxml2-utils
echo Running schema check for $PACK_VENDOR.$PACK_NAME.pdsc
$XMLLINT --noout --schema ${CMSIS_PACK_PATH}/CMSIS/Utilities/PACK.xsd $PACK_BUILD/$PACK_VENDOR.$PACK_NAME.pdsc
errorlevel=$?
if [ $errorlevel -ne 0 ]; then
echo "build aborted: Schema check of $PACK_VENDOR.$PACK_NAME.pdsc against PACK.xsd failed"
echo " "
exit
fi
# Run Pack Check and generate PackName file with version
$PACKCHK $PACK_BUILD/$PACK_VENDOR.$PACK_NAME.pdsc -n PackName.txt -x M362
errorlevel=$?
if [ $errorlevel -ne 0 ]; then
echo "build aborted: pack check failed"
echo " "
exit
fi
PACKNAME=`cat PackName.txt`
rm -rf PackName.txt
# echo apply patches...
# rm -rf $PACK_BUILD/demos/lv_demos.h
# cp -f ./lv_demos.h $PACK_BUILD/demos/
echo delete files...
find $PACK_BUILD/demos/ -type f -name "*.png" -delete
find $PACK_BUILD/demos/ -type f -name "*.gif" -delete
find $PACK_BUILD/demos/ -type f -name "*.gif" -delete
find $PACK_BUILD/demos/ -type f -name "*.ttf" -delete
find $PACK_BUILD/demos/ -type f -name "*.otf" -delete
find $PACK_BUILD/demos/ -type f -name "*.jpg" -delete
find $PACK_BUILD/demos/ -type f -name "*.fnt" -delete
# Archiving
# $ZIP a $PACKNAME
echo creating pack file $PACKNAME
#if $PACK_WAREHOUSE directory does not exist create it
if [ ! -d $PACK_WAREHOUSE ]; then
mkdir -p $PACK_WAREHOUSE
fi
pushd $PACK_WAREHOUSE
PACK_WAREHOUSE=`pwd`
popd
pushd $PACK_BUILD
"$ZIP" a $PACK_WAREHOUSE/$PACKNAME -tzip
popd
errorlevel=$?
if [ $errorlevel -ne 0 ]; then
echo "build aborted: archiving failed"
exit
fi
# cp -f ./$PACK_VENDOR.$PACK_NAME.pdsc ${PACK_WAREHOUSE}
echo "build of pack succeeded"
# Clean up
echo "cleaning up ..."
rm -rf $PACK_BUILD
echo " "
echo Completed CMSIS-Pack Generation: `date`

View File

@ -0,0 +1,139 @@
/****************************************************************************
* Copyright 2022 Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
****************************************************************************/
/**
* @file lv_cmsis_pack.c
*
* @brief This file will only be used by cmsis-pack.
*/
/*********************
* INCLUDES
*********************/
#include "RTE_Components.h"
#include <time.h>
#if defined(__PERF_COUNTER__) && __PERF_COUNTER__
# include "perf_counter.h"
#endif
#include <stdint.h>
#include <stddef.h>
#include "lv_global.h"
/*********************
* DEFINES
*********************/
#define state LV_GLOBAL_DEFAULT()->tick_state
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/*! \name The macros to identify the compiler */
/*! @{ */
/*! \note for IAR */
#undef __IS_COMPILER_IAR__
#if defined(__IAR_SYSTEMS_ICC__)
# define __IS_COMPILER_IAR__ 1
#endif
/*! \note for arm compiler 5 */
#undef __IS_COMPILER_ARM_COMPILER_5__
#if ((__ARMCC_VERSION >= 5000000) && (__ARMCC_VERSION < 6000000))
# define __IS_COMPILER_ARM_COMPILER_5__ 1
#endif
/*! @} */
/*! \note for arm compiler 6 */
#undef __IS_COMPILER_ARM_COMPILER_6__
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
# define __IS_COMPILER_ARM_COMPILER_6__ 1
#endif
#undef __IS_COMPILER_ARM_COMPILER__
#if defined(__IS_COMPILER_ARM_COMPILER_5__) && __IS_COMPILER_ARM_COMPILER_5__ \
|| defined(__IS_COMPILER_ARM_COMPILER_6__) && __IS_COMPILER_ARM_COMPILER_6__
# define __IS_COMPILER_ARM_COMPILER__ 1
#endif
#undef __IS_COMPILER_LLVM__
#if defined(__clang__) && !__IS_COMPILER_ARM_COMPILER_6__
# define __IS_COMPILER_LLVM__ 1
#else
/*! \note for gcc */
# undef __IS_COMPILER_GCC__
# if defined(__GNUC__) && !( defined(__IS_COMPILER_ARM_COMPILER__) \
|| defined(__IS_COMPILER_LLVM__))
# define __IS_COMPILER_GCC__ 1
# endif
/*! @} */
#endif
/*! @} */
/**********************
* GLOBAL FUNCTIONS
**********************/
/* When Arm Compilers using the MicroLib, provide an empty implementation for
* time() which is not included in the MicroLib
*/
#if defined(__IS_COMPILER_ARM_COMPILER__) && __IS_COMPILER_ARM_COMPILER__
# if defined(__MICROLIB)
__attribute__((weak))
_ARMABI time_t time(time_t * time)
{
return (time_t)(-1);
}
# endif
# if defined(__PERF_COUNTER__) && __PERF_COUNTER__
/**
* Get the elapsed milliseconds since start up from perf_counter
* @return the elapsed milliseconds
*/
uint32_t perfc_tick_get(void)
{
return (uint32_t)get_system_ms();
}
# endif
#endif

View File

@ -0,0 +1,885 @@
/**
* @file lv_conf.h
* Configuration file for v9.1.0
*/
/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
#if defined(_RTE_)
#include "RTE_Components.h"
#endif
/*If you need to include anything here, do it inside the `__ASSEMBLY__` guard */
#if 0 && defined(__ASSEMBLY__)
#include "my_include.h"
#endif
/*====================
COLOR SETTINGS
*====================*/
/*Color depth: 8 (A8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888)*/
#define LV_COLOR_DEPTH 16
/*=========================
STDLIB WRAPPER SETTINGS
*=========================*/
/* Possible values
* - LV_STDLIB_BUILTIN: LVGL's built in implementation
* - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc
* - LV_STDLIB_MICROPYTHON: MicroPython implementation
* - LV_STDLIB_RTTHREAD: RT-Thread implementation
* - LV_STDLIB_CUSTOM: Implement the functions externally
*/
#define LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN
#define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN
#define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/
#define LV_MEM_SIZE (128 * 1024U) /*[bytes]*/
/*Size of the memory expand for `lv_malloc()` in bytes*/
#define LV_MEM_POOL_EXPAND_SIZE 0
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
#define LV_MEM_ADR 0 /*0: unused*/
/*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/
#if LV_MEM_ADR == 0
#undef LV_MEM_POOL_INCLUDE
#undef LV_MEM_POOL_ALLOC
#endif
#endif /*LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN*/
/*====================
HAL SETTINGS
*====================*/
/*Default display refresh, input device read and animation step period.*/
#define LV_DEF_REFR_PERIOD 33 /*[ms]*/
/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
*(Not so important, you can adjust it to modify default sizes and spaces)*/
#define LV_DPI_DEF 130 /*[px/inch]*/
/*customize tick-get */
#if defined(__PERF_COUNTER__) && __PERF_COUNTER__
#define LV_GLOBAL_INIT(__GLOBAL_PTR) \
do { \
lv_global_init((lv_global_t *)(__GLOBAL_PTR)); \
extern uint32_t perfc_tick_get(void); \
(__GLOBAL_PTR)->tick_state.tick_get_cb = perfc_tick_get; \
} while(0)
#endif
/*=================
* OPERATING SYSTEM
*=================*/
#if LV_USE_OS == LV_OS_CUSTOM
#define LV_OS_CUSTOM_INCLUDE <stdint.h>
#endif
/*========================
* RENDERING CONFIGURATION
*========================*/
/*Align the stride of all layers and images to this bytes*/
#define LV_DRAW_BUF_STRIDE_ALIGN 1
/*Align the start address of draw_buf addresses to this bytes*/
#define LV_DRAW_BUF_ALIGN 4
/* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode
* it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks.
* "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers
* and can't be drawn in chunks. */
/*The target buffer size for simple layer chunks.*/
#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/
#define LV_USE_DRAW_SW 1
#if LV_USE_DRAW_SW == 1
/* Set the number of draw unit.
* > 1 requires an operating system enabled in `LV_USE_OS`
* > 1 means multiply threads will render the screen in parallel */
#define LV_DRAW_SW_DRAW_UNIT_CNT 1
/* Enable native helium assembly to be compiled */
#define LV_USE_NATIVE_HELIUM_ASM 0
/* 0: use a simple renderer capable of drawing only simple rectangles with gradient, images, texts, and straight lines only
* 1: use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too */
#define LV_DRAW_SW_COMPLEX 1
#if LV_DRAW_SW_COMPLEX == 1
/*Allow buffering some shadow calculation.
*LV_DRAW_SW_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
*Caching has LV_DRAW_SW_SHADOW_CACHE_SIZE^2 RAM cost*/
#define LV_DRAW_SW_SHADOW_CACHE_SIZE 0
/* Set number of maximally cached circle data.
* The circumference of 1/4 circle are saved for anti-aliasing
* radius * 4 bytes are used per circle (the most often used radiuses are saved)
* 0: to disable caching */
#define LV_DRAW_SW_CIRCLE_CACHE_SIZE 4
#endif
#if !defined(LV_USE_DRAW_SW_ASM) && defined(RTE_Acceleration_Arm_2D)
/*turn-on helium acceleration when Arm-2D and the Helium-powered device are detected */
#if defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE
#define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_HELIUM
#define LV_USE_DRAW_ARM2D_SYNC 1
#endif
#endif
#ifndef LV_USE_DRAW_SW_ASM
#define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE
#endif
#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM
#define LV_DRAW_SW_ASM_CUSTOM_INCLUDE ""
#endif
#endif
#if LV_USE_DRAW_VGLITE
/* Enable blit quality degradation workaround recommended for screen's dimension > 352 pixels. */
#define LV_USE_VGLITE_BLIT_SPLIT 0
#if LV_USE_OS
/* Enable VGLite draw async. Queue multiple tasks and flash them once to the GPU. */
#define LV_USE_VGLITE_DRAW_ASYNC 1
#endif
/* Enable VGLite asserts. */
#define LV_USE_VGLITE_ASSERT 0
#endif
#if LV_USE_DRAW_PXP
/* Enable PXP asserts. */
#define LV_USE_PXP_ASSERT 0
#endif
/* Use VG-Lite GPU. */
#define LV_USE_DRAW_VG_LITE 0
#if LV_USE_DRAW_VG_LITE
/* Enable VG-Lite custom external 'gpu_init()' function */
#define LV_VG_LITE_USE_GPU_INIT 0
/* Enable VG-Lite assert. */
#define LV_VG_LITE_USE_ASSERT 0
/* VG-Lite flush commit trigger threshold. GPU will try to batch these many draw tasks. */
#define LV_VG_LITE_FLUSH_MAX_COUNT 8
/* Enable border to simulate shadow
* NOTE: which usually improves performance,
* but does not guarantee the same rendering quality as the software. */
#define LV_VG_LITE_USE_BOX_SHADOW 0
/* VG-Lite gradient image maximum cache number.
* NOTE: The memory usage of a single gradient image is 4K bytes.
*/
#define LV_VG_LITE_GRAD_CACHE_SIZE 32
#endif
/*=======================
* FEATURE CONFIGURATION
*=======================*/
/*-------------
* Logging
*-----------*/
/*Enable the log module*/
#define LV_USE_LOG 0
#if LV_USE_LOG
/*How important log should be added:
*LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
*LV_LOG_LEVEL_INFO Log important events
*LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
*LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
*LV_LOG_LEVEL_USER Only logs added by the user
*LV_LOG_LEVEL_NONE Do not log anything*/
#define LV_LOG_LEVEL LV_LOG_LEVEL_USER
/*1: Print the log with 'printf';
*0: User need to register a callback with `lv_log_register_print_cb()`*/
#define LV_LOG_PRINTF 1
/*1: Enable print timestamp;
*0: Disable print timestamp*/
#define LV_LOG_USE_TIMESTAMP 1
/*1: Print file and line number of the log;
*0: Do not print file and line number of the log*/
#define LV_LOG_USE_FILE_LINE 1
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
#define LV_LOG_TRACE_MEM 1
#define LV_LOG_TRACE_TIMER 1
#define LV_LOG_TRACE_INDEV 1
#define LV_LOG_TRACE_DISP_REFR 1
#define LV_LOG_TRACE_EVENT 1
#define LV_LOG_TRACE_OBJ_CREATE 1
#define LV_LOG_TRACE_LAYOUT 1
#define LV_LOG_TRACE_ANIM 1
#define LV_LOG_TRACE_CACHE 1
#endif /*LV_USE_LOG*/
/*-------------
* Asserts
*-----------*/
/*Enable asserts if an operation is failed or an invalid data is found.
*If LV_USE_LOG is enabled an error message will be printed on failure*/
#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/
#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/
#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/
#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/
#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/
/*Add a custom handler when assert happens e.g. to restart the MCU*/
#define LV_ASSERT_HANDLER_INCLUDE <stdint.h>
#define LV_ASSERT_HANDLER while(1); /*Halt by default*/
/*-------------
* Debug
*-----------*/
/*1: Draw random colored rectangles over the redrawn areas*/
#define LV_USE_REFR_DEBUG 0
/*1: Draw a red overlay for ARGB layers and a green overlay for RGB layers*/
#define LV_USE_LAYER_DEBUG 0
/*1: Draw overlays with different colors for each draw_unit's tasks.
*Also add the index number of the draw unit on white background.
*For layers add the index number of the draw unit on black background.*/
#define LV_USE_PARALLEL_DRAW_DEBUG 0
/*-------------
* Others
*-----------*/
#define LV_ENABLE_GLOBAL_CUSTOM 0
#if LV_ENABLE_GLOBAL_CUSTOM
/*Header to include for the custom 'lv_global' function"*/
#define LV_GLOBAL_CUSTOM_INCLUDE <stdint.h>
#endif
/*Default cache size in bytes.
*Used by image decoders such as `lv_lodepng` to keep the decoded image in the memory.
*Data larger than the size of the cache also can be allocated but
*will be dropped immediately after usage.*/
#define LV_CACHE_DEF_SIZE 0
/*Default number of image header cache entries. The cache is used to store the headers of images
*The main logic is like `LV_CACHE_DEF_SIZE` but for image headers.*/
#define LV_IMAGE_HEADER_CACHE_DEF_CNT 0
/*Number of stops allowed per gradient. Increase this to allow more stops.
*This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/
#define LV_GRADIENT_MAX_STOPS 2
/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently.
* 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */
#define LV_COLOR_MIX_ROUND_OFS 0
/* Add 2 x 32 bit variables to each lv_obj_t to speed up getting style properties */
#define LV_OBJ_STYLE_CACHE 0
/* Add `id` field to `lv_obj_t` */
#define LV_USE_OBJ_ID 0
/* Use lvgl builtin method for obj ID */
#define LV_USE_OBJ_ID_BUILTIN 0
/*Use obj property set/get API*/
#define LV_USE_OBJ_PROPERTY 0
/* VG-Lite Simulator */
/*Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */
#define LV_USE_VG_LITE_THORVG 0
#if LV_USE_VG_LITE_THORVG
/*Enable LVGL's blend mode support*/
#define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT 0
/*Enable YUV color format support*/
#define LV_VG_LITE_THORVG_YUV_SUPPORT 0
/*Enable 16 pixels alignment*/
#define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1
/*Buffer address alignment*/
#define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN 64
/*Enable multi-thread render*/
#define LV_VG_LITE_THORVG_THREAD_RENDER 0
#endif
/*=====================
* COMPILER SETTINGS
*====================*/
/*For big endian systems set to 1*/
#define LV_BIG_ENDIAN_SYSTEM 0
/*Define a custom attribute to `lv_tick_inc` function*/
#define LV_ATTRIBUTE_TICK_INC
/*Define a custom attribute to `lv_timer_handler` function*/
#define LV_ATTRIBUTE_TIMER_HANDLER
/*Define a custom attribute to `lv_display_flush_ready` function*/
#define LV_ATTRIBUTE_FLUSH_READY
/*Required alignment size for buffers*/
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 4
/*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default).
* E.g. __attribute__((aligned(4)))*/
#define LV_ATTRIBUTE_MEM_ALIGN __attribute__((aligned(4)))
/*Attribute to mark large constant arrays for example font's bitmaps*/
#define LV_ATTRIBUTE_LARGE_CONST
/*Compiler prefix for a big array declaration in RAM*/
#define LV_ATTRIBUTE_LARGE_RAM_ARRAY
/*Place performance critical functions into a faster memory (e.g RAM)*/
#define LV_ATTRIBUTE_FAST_MEM
/*Export integer constant to binding. This macro is used with constants in the form of LV_<CONST> that
*should also appear on LVGL binding API such as Micropython.*/
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/
/*Prefix all global extern data with this*/
#define LV_ATTRIBUTE_EXTERN_DATA
/* Use `float` as `lv_value_precise_t` */
#define LV_USE_FLOAT 0
/*==================
* FONT USAGE
*===================*/
/*Montserrat fonts with ASCII range and some symbols using bpp = 4
*https://fonts.google.com/specimen/Montserrat*/
#define LV_FONT_MONTSERRAT_8 0
#define LV_FONT_MONTSERRAT_10 0
#define LV_FONT_MONTSERRAT_12 1
#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_MONTSERRAT_16 1
#define LV_FONT_MONTSERRAT_18 0
#define LV_FONT_MONTSERRAT_20 0
#define LV_FONT_MONTSERRAT_22 0
#define LV_FONT_MONTSERRAT_24 1
#define LV_FONT_MONTSERRAT_26 0
#define LV_FONT_MONTSERRAT_28 0
#define LV_FONT_MONTSERRAT_30 0
#define LV_FONT_MONTSERRAT_32 0
#define LV_FONT_MONTSERRAT_34 0
#define LV_FONT_MONTSERRAT_36 0
#define LV_FONT_MONTSERRAT_38 0
#define LV_FONT_MONTSERRAT_40 0
#define LV_FONT_MONTSERRAT_42 0
#define LV_FONT_MONTSERRAT_44 0
#define LV_FONT_MONTSERRAT_46 0
#define LV_FONT_MONTSERRAT_48 0
/*Demonstrate special features*/
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
/*Pixel perfect monospace fonts*/
#define LV_FONT_UNSCII_8 0
#define LV_FONT_UNSCII_16 0
/*Optionally declare custom fonts here.
*You can use these fonts as default font too and they will be available globally.
*E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/
#define LV_FONT_CUSTOM_DECLARE
/*Always set a default font*/
#define LV_FONT_DEFAULT &lv_font_montserrat_14
/*Enable handling large font and/or fonts with a lot of characters.
*The limit depends on the font size, font face and bpp.
*Compiler error will be triggered if a font needs it.*/
#define LV_FONT_FMT_TXT_LARGE 0
/*Enables/disables support for compressed fonts.*/
#define LV_USE_FONT_COMPRESSED 0
/*Enable drawing placeholders when glyph dsc is not found*/
#define LV_USE_FONT_PLACEHOLDER 1
/*=================
* TEXT SETTINGS
*=================*/
/**
* Select a character encoding for strings.
* Your IDE or editor should have the same character encoding
* - LV_TXT_ENC_UTF8
* - LV_TXT_ENC_ASCII
*/
#define LV_TXT_ENC LV_TXT_ENC_UTF8
/*Can break (wrap) texts on these chars*/
#define LV_TXT_BREAK_CHARS " ,.;:-_)]}"
/*If a word is at least this long, will break wherever "prettiest"
*To disable, set to a value <= 0*/
#define LV_TXT_LINE_BREAK_LONG_LEN 0
/*Minimum number of characters in a long word to put on a line before a break.
*Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
/*Minimum number of characters in a long word to put on a line after a break.
*Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts.
*The direction will be processed according to the Unicode Bidirectional Algorithm:
*https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
#define LV_USE_BIDI 0
#if LV_USE_BIDI
/*Set the default direction. Supported values:
*`LV_BASE_DIR_LTR` Left-to-Right
*`LV_BASE_DIR_RTL` Right-to-Left
*`LV_BASE_DIR_AUTO` detect texts base direction*/
#define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO
#endif
/*Enable Arabic/Persian processing
*In these languages characters should be replaced with an other form based on their position in the text*/
#define LV_USE_ARABIC_PERSIAN_CHARS 0
/*==================
* WIDGETS
*================*/
/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/
#define LV_WIDGETS_HAS_DEFAULT_VALUE 1
#define LV_USE_ANIMIMG 1
#define LV_USE_ARC 1
#define LV_USE_BAR 1
#define LV_USE_BUTTON 1
#define LV_USE_BUTTONMATRIX 1
#define LV_USE_CALENDAR 1
#if LV_USE_CALENDAR
#define LV_CALENDAR_WEEK_STARTS_MONDAY 0
#if LV_CALENDAR_WEEK_STARTS_MONDAY
#define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"}
#else
#define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"}
#endif
#define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
#define LV_USE_CALENDAR_HEADER_ARROW 1
#define LV_USE_CALENDAR_HEADER_DROPDOWN 1
#endif /*LV_USE_CALENDAR*/
#define LV_USE_CANVAS 1
#define LV_USE_CHART 1
#define LV_USE_CHECKBOX 1
#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/
#define LV_USE_IMAGE 1 /*Requires: lv_label*/
#define LV_USE_IMAGEBUTTON 1
#define LV_USE_KEYBOARD 1
#define LV_USE_LABEL 1
#if LV_USE_LABEL
#define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/
#define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/
#define LV_LABEL_WAIT_CHAR_COUNT 3 /*The count of wait chart*/
#endif
#define LV_USE_LED 1
#define LV_USE_LINE 1
#define LV_USE_LIST 1
#define LV_USE_MENU 1
#define LV_USE_MSGBOX 1
#define LV_USE_ROLLER 1 /*Requires: lv_label*/
#define LV_USE_SCALE 1
#define LV_USE_SLIDER 1 /*Requires: lv_bar*/
#define LV_USE_SPAN 1
#if LV_USE_SPAN
/*A line text can contain maximum num of span descriptor */
#define LV_SPAN_SNIPPET_STACK_SIZE 64
#endif
#define LV_USE_SPINBOX 1
#define LV_USE_SPINNER 1
#define LV_USE_SWITCH 1
#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/
#if LV_USE_TEXTAREA != 0
#define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#endif
#define LV_USE_TABLE 1
#define LV_USE_TABVIEW 1
#define LV_USE_TILEVIEW 1
#define LV_USE_WIN 1
/*==================
* THEMES
*==================*/
/*A simple, impressive and very complete theme*/
#define LV_USE_THEME_DEFAULT 1
#if LV_USE_THEME_DEFAULT
/*0: Light mode; 1: Dark mode*/
#define LV_THEME_DEFAULT_DARK 0
/*1: Enable grow on press*/
#define LV_THEME_DEFAULT_GROW 1
/*Default transition time in [ms]*/
#define LV_THEME_DEFAULT_TRANSITION_TIME 80
#endif /*LV_USE_THEME_DEFAULT*/
/*A very simple theme that is a good starting point for a custom theme*/
#define LV_USE_THEME_SIMPLE 1
/*A theme designed for monochrome displays*/
#define LV_USE_THEME_MONO 1
/*==================
* LAYOUTS
*==================*/
/*A layout similar to Flexbox in CSS.*/
#define LV_USE_FLEX 1
/*A layout similar to Grid in CSS.*/
#define LV_USE_GRID 1
/*====================
* 3RD PARTS LIBRARIES
*====================*/
/*File system interfaces for common APIs */
/*API for fopen, fread, etc*/
#if LV_USE_FS_STDIO
#define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
#define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
/*API for open, read, etc*/
#if LV_USE_FS_POSIX
#define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
#define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
/*API for CreateFile, ReadFile, etc*/
#if LV_USE_FS_WIN32
#define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
#define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/
#if LV_USE_FS_FATFS
#define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
/*API for memory-mapped file access. */
#if LV_USE_FS_MEMFS
#define LV_FS_MEMFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#endif
/*API for LittleFs. */
#if LV_USE_FS_LITTLEFS
#define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#endif
/*GIF decoder library*/
#if LV_USE_GIF
/*GIF decoder accelerate*/
#define LV_GIF_CACHE_DECODE_DATA 0
#endif
/*Decode bin images to RAM*/
#define LV_BIN_DECODER_RAM_LOAD 0
/*FreeType library*/
#if LV_USE_FREETYPE
/*Let FreeType to use LVGL memory and file porting*/
#define LV_FREETYPE_USE_LVGL_PORT 0
/*Cache count of the glyphs in FreeType. It means the number of glyphs that can be cached.
*The higher the value, the more memory will be used.*/
#define LV_FREETYPE_CACHE_FT_GLYPH_CNT 256
#endif
/* Built-in TTF decoder */
#if LV_USE_TINY_TTF
/* Enable loading TTF data from files */
#define LV_TINY_TTF_FILE_SUPPORT 0
#endif
/*Enable Vector Graphic APIs*/
#ifndef LV_USE_VECTOR_GRAPHIC
# define LV_USE_VECTOR_GRAPHIC 0
/* Enable ThorVG (vector graphics library) from the src/libs folder */
# define LV_USE_THORVG_INTERNAL 0
/* Enable ThorVG by assuming that its installed and linked to the project */
# define LV_USE_THORVG_EXTERNAL 0
#endif
/*Enable LZ4 compress/decompress lib*/
#ifndef LV_USE_LZ4
/*Use lvgl built-in LZ4 lib*/
# define LV_USE_LZ4_INTERNAL 0
/*Use external LZ4 library*/
# define LV_USE_LZ4_EXTERNAL 0
#endif
/*FFmpeg library for image decoding and playing videos
*Supports all major image formats so do not enable other image decoder with it*/
#if LV_USE_FFMPEG
/*Dump input information to stderr*/
#define LV_FFMPEG_DUMP_FORMAT 0
#endif
/*==================
* OTHERS
*==================*/
/*1: Enable system monitor component*/
#define LV_USE_SYSMON 0
#if LV_USE_SYSMON
/*1: Show CPU usage and FPS count
* Requires `LV_USE_SYSMON = 1`*/
#define LV_USE_PERF_MONITOR 0
#if LV_USE_PERF_MONITOR
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
/*0: Displays performance data on the screen, 1: Prints performance data using log.*/
#define LV_USE_PERF_MONITOR_LOG_MODE 0
#endif
/*1: Show the used memory and the memory fragmentation
* Requires `LV_USE_STDLIB_MALLOC = LV_STDLIB_BUILTIN`
* Requires `LV_USE_SYSMON = 1`*/
#define LV_USE_MEM_MONITOR 0
#if LV_USE_MEM_MONITOR
#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
#endif
#endif /*LV_USE_SYSMON*/
/*1: Enable the runtime performance profiler*/
#define LV_USE_PROFILER 0
#if LV_USE_PROFILER
/*1: Enable the built-in profiler*/
#define LV_USE_PROFILER_BUILTIN 1
#if LV_USE_PROFILER_BUILTIN
/*Default profiler trace buffer size*/
#define LV_PROFILER_BUILTIN_BUF_SIZE (16 * 1024) /*[bytes]*/
#endif
/*Header to include for the profiler*/
#define LV_PROFILER_INCLUDE "src/misc/lv_profiler_builtin.h"
/*Profiler start point function*/
#define LV_PROFILER_BEGIN LV_PROFILER_BUILTIN_BEGIN
/*Profiler end point function*/
#define LV_PROFILER_END LV_PROFILER_BUILTIN_END
/*Profiler start point function with custom tag*/
#define LV_PROFILER_BEGIN_TAG LV_PROFILER_BUILTIN_BEGIN_TAG
/*Profiler end point function with custom tag*/
#define LV_PROFILER_END_TAG LV_PROFILER_BUILTIN_END_TAG
#endif
/*1: Enable an observer pattern implementation*/
#define LV_USE_OBSERVER 1
/*1: Enable Pinyin input method*/
/*Requires: lv_keyboard*/
#if LV_USE_IME_PINYIN
/*1: Use default thesaurus*/
/*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesauruss*/
#define LV_IME_PINYIN_USE_DEFAULT_DICT 1
/*Set the maximum number of candidate panels that can be displayed*/
/*This needs to be adjusted according to the size of the screen*/
#define LV_IME_PINYIN_CAND_TEXT_NUM 6
/*Use 9 key input(k9)*/
#define LV_IME_PINYIN_USE_K9_MODE 1
#if LV_IME_PINYIN_USE_K9_MODE == 1
#define LV_IME_PINYIN_K9_CAND_TEXT_NUM 3
#endif /*LV_IME_PINYIN_USE_K9_MODE*/
#endif
/*1: Enable file explorer*/
/*Requires: lv_table*/
#if LV_USE_FILE_EXPLORER
/*Maximum length of path*/
#define LV_FILE_EXPLORER_PATH_MAX_LEN (128)
/*Quick access bar, 1:use, 0:not use*/
/*Requires: lv_list*/
#define LV_FILE_EXPLORER_QUICK_ACCESS 1
#endif
/*==================
* DEVICES
*==================*/
/*Use SDL to open window on PC and handle mouse and keyboard*/
#define LV_USE_SDL 0
#if LV_USE_SDL
#define LV_SDL_INCLUDE_PATH <SDL2/SDL.h>
#define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /*LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance*/
#define LV_SDL_BUF_COUNT 1 /*1 or 2*/
#define LV_SDL_FULLSCREEN 0 /*1: Make the window full screen by default*/
#define LV_SDL_DIRECT_EXIT 1 /*1: Exit the application when all SDL windows are closed*/
#define LV_SDL_MOUSEWHEEL_MODE LV_SDL_MOUSEWHEEL_MODE_ENCODER /*LV_SDL_MOUSEWHEEL_MODE_ENCODER/CROWN*/
#endif
/*Use X11 to open window on Linux desktop and handle mouse and keyboard*/
#define LV_USE_X11 0
#if LV_USE_X11
#define LV_X11_DIRECT_EXIT 1 /*Exit the application when all X11 windows have been closed*/
#define LV_X11_DOUBLE_BUFFER 1 /*Use double buffers for endering*/
/*select only 1 of the following render modes (LV_X11_RENDER_MODE_PARTIAL preferred!)*/
#define LV_X11_RENDER_MODE_PARTIAL 1 /*Partial render mode (preferred)*/
#define LV_X11_RENDER_MODE_DIRECT 0 /*direct render mode*/
#define LV_X11_RENDER_MODE_FULL 0 /*Full render mode*/
#endif
/*Driver for /dev/fb*/
#define LV_USE_LINUX_FBDEV 0
#if LV_USE_LINUX_FBDEV
#define LV_LINUX_FBDEV_BSD 0
#define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL
#define LV_LINUX_FBDEV_BUFFER_COUNT 0
#define LV_LINUX_FBDEV_BUFFER_SIZE 60
#endif
/*Use Nuttx to open window and handle touchscreen*/
#define LV_USE_NUTTX 0
#if LV_USE_NUTTX
#define LV_USE_NUTTX_LIBUV 0
/*Use Nuttx custom init API to open window and handle touchscreen*/
#define LV_USE_NUTTX_CUSTOM_INIT 0
/*Driver for /dev/lcd*/
#define LV_USE_NUTTX_LCD 0
#if LV_USE_NUTTX_LCD
#define LV_NUTTX_LCD_BUFFER_COUNT 0
#define LV_NUTTX_LCD_BUFFER_SIZE 60
#endif
/*Driver for /dev/input*/
#define LV_USE_NUTTX_TOUCHSCREEN 0
#endif
/*Driver for evdev input devices*/
#define LV_USE_EVDEV 0
/*Driver for libinput input devices*/
#define LV_USE_LIBINPUT 0
#if LV_USE_LIBINPUT
#define LV_LIBINPUT_BSD 0
/*Full keyboard support*/
#define LV_LIBINPUT_XKB 0
#if LV_LIBINPUT_XKB
/*"setxkbmap -query" can help find the right values for your keyboard*/
#define LV_LIBINPUT_XKB_KEY_MAP { .rules = NULL, .model = "pc101", .layout = "us", .variant = NULL, .options = NULL }
#endif
#endif
#define LV_USE_GENERIC_MIPI (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341)
/*==================
* EXAMPLES
*==================*/
/*Enable the examples to be built with the library*/
#define LV_BUILD_EXAMPLES 1
/*===================
* DEMO USAGE
====================*/
/*Music player demo*/
#if LV_USE_DEMO_MUSIC
#define LV_DEMO_MUSIC_SQUARE 0
#define LV_DEMO_MUSIC_LANDSCAPE 0
#define LV_DEMO_MUSIC_ROUND 0
#define LV_DEMO_MUSIC_LARGE 0
#define LV_DEMO_MUSIC_AUTO_PLAY 0
#endif
/*--END OF LV_CONF_H--*/
#endif /*LV_CONF_H*/
#endif /*End of "Content enable"*/

View File

@ -0,0 +1,120 @@
/**
* @file lv_os_custom.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_os.h"
#if LV_USE_OS == LV_OS_CUSTOM
#include "../misc/lv_types.h"
#include "../misc/lv_assert.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
lv_result_t lv_thread_init(lv_thread_t * thread, lv_thread_prio_t prio, void (*callback)(void *), size_t stack_size,
void * user_data)
{
LV_UNUSED(thread);
LV_UNUSED(callback);
LV_UNUSED(prio);
LV_UNUSED(stack_size);
LV_UNUSED(user_data);
LV_ASSERT(0);
return LV_RESULT_INVALID;
}
lv_result_t lv_thread_delete(lv_thread_t * thread)
{
LV_UNUSED(thread);
LV_ASSERT(0);
return LV_RESULT_INVALID;
}
lv_result_t lv_mutex_init(lv_mutex_t * mutex)
{
LV_UNUSED(mutex);
return LV_RESULT_OK;
}
lv_result_t lv_mutex_lock(lv_mutex_t * mutex)
{
LV_UNUSED(mutex);
return LV_RESULT_OK;
}
lv_result_t lv_mutex_lock_isr(lv_mutex_t * mutex)
{
LV_UNUSED(mutex);
return LV_RESULT_OK;
}
lv_result_t lv_mutex_unlock(lv_mutex_t * mutex)
{
LV_UNUSED(mutex);
return LV_RESULT_OK;
}
lv_result_t lv_mutex_delete(lv_mutex_t * mutex)
{
LV_UNUSED(mutex);
return LV_RESULT_OK;
}
lv_result_t lv_thread_sync_init(lv_thread_sync_t * sync)
{
LV_UNUSED(sync);
LV_ASSERT(0);
return LV_RESULT_INVALID;
}
lv_result_t lv_thread_sync_wait(lv_thread_sync_t * sync)
{
LV_UNUSED(sync);
LV_ASSERT(0);
return LV_RESULT_INVALID;
}
lv_result_t lv_thread_sync_signal(lv_thread_sync_t * sync)
{
LV_UNUSED(sync);
LV_ASSERT(0);
return LV_RESULT_INVALID;
}
lv_result_t lv_thread_sync_delete(lv_thread_sync_t * sync)
{
LV_UNUSED(sync);
LV_ASSERT(0);
return LV_RESULT_INVALID;
}
/**********************
* STATIC FUNCTIONS
**********************/
#endif /*LV_USE_OS == LV_OS_CUSTOM*/

View File

@ -0,0 +1,43 @@
/**
* @file lv_os_custom.h
*
*/
#ifndef LV_OS_CUSTOM_H
#define LV_OS_CUSTOM_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#if LV_USE_OS == LV_OS_CUSTOM
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef int lv_mutex_t;
typedef int lv_thread_t;
typedef int lv_thread_sync_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /*LV_USE_OS == LV_OS_CUSTOM*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OS_CUSTOM_H*/

View File

@ -0,0 +1,90 @@
From 18083a559734d297838e4cf34a856a4770062319 Mon Sep 17 00:00:00 2001
From: tvanfossen <vanfosst@gmail.com>
Date: Tue, 23 Aug 2022 10:06:53 -0400
Subject: [PATCH] changes to compile with esp-idf
---
CMakeLists.txt | 11 ++++++-----
src/vector/vimageloader.cpp | 23 +++++++++++++----------
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38a9862..ee6d2cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -95,10 +95,11 @@ if (NOT APPLE AND NOT WIN32)
)
endif()
-if (LOTTIE_MODULE)
- # for dlopen, dlsym and dlclose dependency
- target_link_libraries(rlottie PRIVATE ${CMAKE_DL_LIBS})
-endif()
+# No Sym links in ESP-IDF
+# if (LOTTIE_MODULE)
+# # for dlopen, dlsym and dlclose dependency
+# target_link_libraries(rlottie PRIVATE ${CMAKE_DL_LIBS})
+# endif()
if (NOT LOTTIE_ASAN)
if(APPLE)
@@ -137,7 +138,7 @@ endif (NOT LIB_INSTALL_DIR)
#declare source and include files
add_subdirectory(inc)
add_subdirectory(src)
-add_subdirectory(example)
+# add_subdirectory(example) // We dont need example dir in ESP-IDF
if (LOTTIE_TEST)
enable_testing()
diff --git a/src/vector/vimageloader.cpp b/src/vector/vimageloader.cpp
index c2446be..3df4c6a 100644
--- a/src/vector/vimageloader.cpp
+++ b/src/vector/vimageloader.cpp
@@ -6,7 +6,7 @@
#ifdef _WIN32
# include <windows.h>
#else
-# include <dlfcn.h>
+// # include <dlfcn.h> //Does not work on ESP-IDF
#endif // _WIN32
using lottie_image_load_f = unsigned char *(*)(const char *filename, int *x,
@@ -61,22 +61,25 @@ struct VImageLoader::Impl {
void *dl_handle{nullptr};
void init()
{
- imageLoad = reinterpret_cast<lottie_image_load_f>(
- dlsym(dl_handle, "lottie_image_load"));
- imageFree = reinterpret_cast<lottie_image_free_f>(
- dlsym(dl_handle, "lottie_image_free"));
- imageFromData = reinterpret_cast<lottie_image_load_data_f>(
- dlsym(dl_handle, "lottie_image_load_from_data"));
+ // No sym links in ESP-iDF
+ // imageLoad = reinterpret_cast<lottie_image_load_f>(
+ // dlsym(dl_handle, "lottie_image_load"));
+ // imageFree = reinterpret_cast<lottie_image_free_f>(
+ // dlsym(dl_handle, "lottie_image_free"));
+ // imageFromData = reinterpret_cast<lottie_image_load_data_f>(
+ // dlsym(dl_handle, "lottie_image_load_from_data"));
}
void moduleFree()
{
- if (dl_handle) dlclose(dl_handle);
+ // if (dl_handle) dlclose(dl_handle); // No sym links in ESP-iDF
}
bool moduleLoad()
{
- dl_handle = dlopen(LOTTIE_IMAGE_MODULE_PLUGIN, RTLD_LAZY);
- return (dl_handle == nullptr);
+ // No sym links in ESP idf
+ // dl_handle = dlopen(LOTTIE_IMAGE_MODULE_PLUGIN, RTLD_LAZY);
+ // return (dl_handle == nullptr);
+ return true
}
# endif // _WIN32
#else // LOTTIE_IMAGE_MODULE_SUPPORT
--
2.34.1

View File

@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.5)
if (0)
if (LV_USE_RLOTTIE)
idf_component_register(SRCS ${SOURCES}
INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/rlottie/inc"
)
set(LOTTIE_MODULE OFF)
set(LOTTIE_THREAD OFF)
set(BUILD_SHARED_LIBS OFF)
option(BUILD_TESTING OFF)
function(install)
endfunction()
function(export)
endfunction()
add_subdirectory(rlottie)
target_link_libraries(${COMPONENT_LIB} INTERFACE rlottie)
endif()
endif()

View File

@ -0,0 +1,11 @@
# PikaScript Binding for LVGL
[PikaScript](https://github.com/pikasTech/pikascript) is an ultralightweight python engine that can run with 4KB of RAM and 32KB of Flash (such as STM32G030C8 and STM32F103C8), and is very easy to deploy and expand.
More details to see: [PikaScript and lvgl: Make Python Lighter, Easier and Smarter](https://blog.lvgl.io/2022-08-24/pikascript-and-lvgl)
The available Python APIs are in the `pika_lvgl.pyi`, and you need copy the `pika_lvgl.pyi` to the root path of pikascript, then `import pika_lvgl` in `main.py`.
The available simulation project on windows: https://github.com/pikasTech/lv_pikascript
More document about PikaScript: https://pikadoc.readthedocs.io/en/latest/index.html

View File

@ -0,0 +1,16 @@
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
#include "lvgl.h"
#else
#include "../../lvgl.h"
#endif
#ifdef PIKASCRIPT
#include "pika_lvgl_point_t.h"
void pika_lvgl_point_t___init__(PikaObj* self) {
lv_point_t lv_point = {0};
args_setStruct(self->list, "lv_point_struct", lv_point);
obj_setPtr(self, "lv_point", args_getStruct(self->list, "lv_point_struct"));
}
#endif

View File

@ -0,0 +1,44 @@
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
#include "lvgl.h"
#else
#include "../../lvgl.h"
#endif
#ifdef PIKASCRIPT
#include "pika_lvgl_lv_timer_t.h"
PikaEventListener* g_pika_lv_timer_event_listener;
void __pika_timer_cb(lv_timer_t* timer) {
PikaObj* eventHandleObj = pks_eventLisener_getEventHandleObj(
g_pika_lv_timer_event_listener, (uint32_t)timer);
obj_newDirectObj(eventHandleObj, "timer", New_pika_lvgl_lv_timer_t);
obj_setPtr(obj_getPtr(eventHandleObj, "timer"), "lv_timer", timer);
obj_run(eventHandleObj, "eventCallBack(timer)");
}
void pika_lvgl_lv_timer_t_set_period(PikaObj* self, int period) {
lv_timer_t* lv_timer = obj_getPtr(self, "lv_timer");
lv_timer_set_period(lv_timer, period);
}
void pika_lvgl_lv_timer_t_set_cb(PikaObj* self, Arg* cb) {
lv_timer_t* lv_timer = obj_getPtr(self, "lv_timer");
lv_timer_set_cb(lv_timer, __pika_timer_cb);
obj_setArg(self, "eventCallBack", cb);
/* init event_listener for the first time */
if (NULL == g_pika_lv_timer_event_listener) {
pks_eventLisener_init(&g_pika_lv_timer_event_listener);
}
pks_eventLicener_registerEvent(g_pika_lv_timer_event_listener,
(uint32_t)lv_timer, self);
}
void pika_lvgl_lv_timer_t__delete(PikaObj* self) {
lv_timer_t* lv_timer = obj_getPtr(self, "lv_timer");
lv_timer_delete(lv_timer);
}
#endif

View File

@ -0,0 +1,364 @@
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
#include "lvgl.h"
#else
#include "../../lvgl.h"
#endif
#ifdef PIKASCRIPT
#include "BaseObj.h"
#include "pika_lvgl.h"
#include "pika_lvgl_arc.h"
#include "pika_lvgl_bar.h"
#include "pika_lvgl_btn.h"
#include "pika_lvgl_checkbox.h"
#include "pika_lvgl_dropdown.h"
#include "pika_lvgl_label.h"
#include "pika_lvgl_lv_obj.h"
#include "pika_lvgl_roller.h"
#include "pika_lvgl_slider.h"
#include "pika_lvgl_switch.h"
#include "pika_lvgl_table.h"
#include "pika_lvgl_textarea.h"
void pika_lvgl_arc___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_arc_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
obj_setInt(self, "MODE_NORMAL", LV_ARC_MODE_NORMAL);
obj_setInt(self, "MODE_SYMMETRICAL", LV_ARC_MODE_SYMMETRICAL);
obj_setInt(self, "MODE_REVERSE", LV_ARC_MODE_REVERSE);
}
void pika_lvgl_arc_set_end_angle(PikaObj* self, int angle) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_end_angle(lv_obj, angle);
}
void pika_lvgl_arc_set_bg_angles(PikaObj* self, int start, int end) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_bg_angles(lv_obj, start, end);
}
void pika_lvgl_arc_set_angles(PikaObj* self, int start, int end) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_angles(lv_obj, start, end);
}
int pika_lvgl_arc_get_angle_end(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_angle_end(lv_obj);
}
int pika_lvgl_arc_get_angle_start(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_angle_start(lv_obj);
}
int pika_lvgl_arc_get_bg_angle_end(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_bg_angle_end(lv_obj);
}
int pika_lvgl_arc_get_bg_angle_start(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_bg_angle_start(lv_obj);
}
int pika_lvgl_arc_get_max_value(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_max_value(lv_obj);
}
int pika_lvgl_arc_get_min_value(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_min_value(lv_obj);
}
int pika_lvgl_arc_get_mode(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_mode(lv_obj);
}
// int pika_lvgl_arc_get_rotation(PikaObj *self){
// lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
// return lv_arc_get_rotation(lv_obj);
// }
int pika_lvgl_arc_get_value(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_arc_get_value(lv_obj);
}
void pika_lvgl_arc_set_mode(PikaObj *self, int mode){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_mode(lv_obj, mode);
}
void pika_lvgl_arc_set_range(PikaObj *self, int min, int max){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_range(lv_obj, min, max);
}
void pika_lvgl_arc_set_rotation(PikaObj *self, int rotation){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_rotation(lv_obj, rotation);
}
void pika_lvgl_arc_set_start_angle(PikaObj *self, int start){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_start_angle(lv_obj, start);
}
void pika_lvgl_arc_set_value(PikaObj *self, int value){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_value(lv_obj, value);
}
void pika_lvgl_arc_set_bg_end_angle(PikaObj *self, int angle){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_bg_end_angle(lv_obj, angle);
}
void pika_lvgl_arc_set_bg_start_angle(PikaObj *self, int start){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_bg_start_angle(lv_obj, start);
}
void pika_lvgl_arc_set_change_rate(PikaObj *self, int rate){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_arc_set_change_rate(lv_obj, rate);
}
void pika_lvgl_bar___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_bar_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
}
void pika_lvgl_bar_set_value(PikaObj* self, int value, int anim) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_bar_set_value(lv_obj, value, value);
}
int pika_lvgl_bar_get_max_value(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_bar_get_max_value(lv_obj);
}
int pika_lvgl_bar_get_min_value(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_bar_get_min_value(lv_obj);
}
int pika_lvgl_bar_get_mode(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_bar_get_mode(lv_obj);
}
int pika_lvgl_bar_get_start_value(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_bar_get_start_value(lv_obj);
}
int pika_lvgl_bar_get_value(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_bar_get_value(lv_obj);
}
void pika_lvgl_bar_set_mode(PikaObj *self, int mode){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_bar_set_mode(lv_obj, mode);
}
void pika_lvgl_bar_set_range(PikaObj *self, int min, int max){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_bar_set_range(lv_obj, min, max);
}
void pika_lvgl_bar_set_start_value(PikaObj *self, int start_value, int anim){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_bar_set_start_value(lv_obj, start_value, anim);
}
void pika_lvgl_btn___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_button_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
}
void pika_lvgl_checkbox___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_checkbox_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
}
void pika_lvgl_checkbox_set_text(PikaObj* self, char* txt) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_checkbox_set_text(lv_obj, txt);
}
void pika_lvgl_checkbox_set_text_static(PikaObj *self, char* txt){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_checkbox_set_text_static(lv_obj, txt);
}
char* pika_lvgl_checkbox_get_text(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return (char*) lv_checkbox_get_text(lv_obj);
}
void pika_lvgl_dropdown___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_dropdown_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
}
void pika_lvgl_dropdown_set_options(PikaObj* self, char* options) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_set_options(lv_obj, options);
}
void pika_lvgl_dropdown_add_option(PikaObj *self, char* options, int pos){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_add_option(lv_obj, options, pos);
}
void pika_lvgl_dropdown_clear_options(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_clear_options(lv_obj);
}
void pika_lvgl_dropdown_close(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_close(lv_obj);
}
int pika_lvgl_dropdown_get_dir(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_dropdown_get_dir(lv_obj);
}
// PikaObj* pika_lvgl_dropdown_get_list(PikaObj *self){
// lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
// return obj_getObj(lv_dropdown_get_list(lv_obj));
// }
int pika_lvgl_dropdown_get_option_count(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_dropdown_get_option_count(lv_obj);
}
int pika_lvgl_dropdown_get_option_index(PikaObj *self, char* txt){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_dropdown_get_option_index(lv_obj, txt);
}
char* pika_lvgl_dropdown_get_options(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return (char*) lv_dropdown_get_options(lv_obj);
}
int pika_lvgl_dropdown_get_selected(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_dropdown_get_selected(lv_obj);
}
int pika_lvgl_dropdown_get_selected_highlight(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_dropdown_get_selected_highlight(lv_obj);
}
char* pika_lvgl_dropdown_get_selected_str(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
obj_setBytes(self, "_buff",NULL, 128);
char* _buff = (char*)obj_getBytes(self, "_buff");
lv_dropdown_get_selected_str(lv_obj, _buff, 128);
return _buff;
}
char* pika_lvgl_dropdown_get_symbol(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return (char*)lv_dropdown_get_symbol(lv_obj);
}
char* pika_lvgl_dropdown_get_text(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return (char*)lv_dropdown_get_text(lv_obj);
}
int pika_lvgl_dropdown_is_open(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_dropdown_is_open(lv_obj);
}
void pika_lvgl_dropdown_open(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_open(lv_obj);
}
void pika_lvgl_dropdown_set_dir(PikaObj *self, int dir){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_set_dir(lv_obj, dir);
}
void pika_lvgl_dropdown_set_selected(PikaObj *self, int sel_opt){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_set_selected(lv_obj, sel_opt);
}
void pika_lvgl_dropdown_set_selected_highlight(PikaObj *self, int en){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_set_selected_highlight(lv_obj, en);
}
void pika_lvgl_dropdown_set_symbol(PikaObj *self, char* symbol){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_set_symbol(lv_obj, symbol);
}
void pika_lvgl_dropdown_set_text(PikaObj *self, char* txt){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_dropdown_set_text(lv_obj, txt);
}
void pika_lvgl_label___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_label_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
}
void pika_lvgl_label_set_long_mode(PikaObj* self, int mode) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_label_set_long_mode(lv_obj, mode);
}
void pika_lvgl_label_set_recolor(PikaObj* self, int en) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_label_set_recolor(lv_obj, en);
}
void pika_lvgl_label_set_text(PikaObj* self, char* txt) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_label_set_text(lv_obj, txt);
}
void pika_lvgl_label_set_style_text_align(PikaObj* self,
int value,
int selector) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_set_style_text_align(lv_obj, value, selector);
}
void pika_lvgl_roller___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_roller_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
}
void pika_lvgl_roller_set_options(PikaObj* self, char* options, int mode) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_roller_set_options(lv_obj, options, mode);
}
void pika_lvgl_roller_set_visible_row_count(PikaObj* self, int row_cnt) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_roller_set_visible_row_count(lv_obj, row_cnt);
}
void pika_lvgl_slider___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_slider_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
}
void pika_lvgl_switch___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_switch_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
}
void pika_lvgl_table___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_table_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
}
void pika_lvgl_table_set_cell_value(PikaObj* self,
int row,
int col,
char* txt) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_table_set_cell_value(lv_obj, row, col, txt);
}
void pika_lvgl_textarea___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_textarea_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
}
void pika_lvgl_textarea_set_one_line(PikaObj* self, int en) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_textarea_set_one_line(lv_obj, en);
}
#endif

View File

@ -0,0 +1,199 @@
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
#include "lvgl.h"
#else
#include "../../lvgl.h"
#endif
#ifdef PIKASCRIPT
#include "pika_lvgl.h"
#include "BaseObj.h"
#include "pika_lvgl_ALIGN.h"
#include "pika_lvgl_ANIM.h"
#include "pika_lvgl_EVENT.h"
#include "pika_lvgl_OPA.h"
#include "pika_lvgl_PALETTE.h"
#include "pika_lvgl_STATE.h"
#include "pika_lvgl_arc.h"
#include "pika_lvgl_lv_color_t.h"
#include "pika_lvgl_lv_obj.h"
#include "pika_lvgl_indev_t.h"
#include "pika_lvgl_lv_timer_t.h"
PikaObj* pika_lv_event_listener_g;
void pika_lvgl_STATE___init__(PikaObj* self) {
obj_setInt(self, "DEFAULT", LV_STATE_DEFAULT);
obj_setInt(self, "CHECKED", LV_STATE_CHECKED);
obj_setInt(self, "FOCUSED", LV_STATE_FOCUSED);
obj_setInt(self, "FOCUS_KEY", LV_STATE_FOCUS_KEY);
obj_setInt(self, "EDITED", LV_STATE_EDITED);
obj_setInt(self, "HOVERED", LV_STATE_HOVERED);
obj_setInt(self, "PRESSED", LV_STATE_PRESSED);
obj_setInt(self, "SCROLLED", LV_STATE_SCROLLED);
obj_setInt(self, "DISABLED", LV_STATE_DISABLED);
obj_setInt(self, "USER_1", LV_STATE_USER_1);
obj_setInt(self, "USER_2", LV_STATE_USER_2);
obj_setInt(self, "USER_3", LV_STATE_USER_3);
obj_setInt(self, "USER_4", LV_STATE_USER_4);
obj_setInt(self, "ANY", LV_STATE_ANY);
}
void pika_lvgl_ANIM___init__(PikaObj* self) {
obj_setInt(self, "ON", LV_ANIM_OFF);
obj_setInt(self, "OFF", LV_ANIM_ON);
}
void pika_lvgl_ALIGN___init__(PikaObj* self) {
obj_setInt(self, "CENTER", LV_ALIGN_CENTER);
obj_setInt(self, "DEFAULT", LV_ALIGN_DEFAULT);
obj_setInt(self, "TOP_LEFT", LV_ALIGN_TOP_LEFT);
obj_setInt(self, "TOP_MID", LV_ALIGN_TOP_MID);
obj_setInt(self, "TOP_RIGHT", LV_ALIGN_TOP_RIGHT);
obj_setInt(self, "BOTTOM_LEFT", LV_ALIGN_BOTTOM_LEFT);
obj_setInt(self, "BOTTOM_MID", LV_ALIGN_BOTTOM_MID);
obj_setInt(self, "BOTTOM_RIGHT", LV_ALIGN_BOTTOM_RIGHT);
obj_setInt(self, "LEFT_MID", LV_ALIGN_LEFT_MID);
obj_setInt(self, "RIGHT_MID", LV_ALIGN_RIGHT_MID);
obj_setInt(self, "OUT_TOP_LEFT", LV_ALIGN_OUT_TOP_LEFT);
obj_setInt(self, "OUT_TOP_MID", LV_ALIGN_OUT_TOP_MID);
obj_setInt(self, "OUT_TOP_RIGHT", LV_ALIGN_OUT_TOP_RIGHT);
obj_setInt(self, "OUT_BOTTOM_LEFT", LV_ALIGN_OUT_BOTTOM_LEFT);
obj_setInt(self, "OUT_BOTTOM_MID", LV_ALIGN_OUT_BOTTOM_MID);
obj_setInt(self, "OUT_BOTTOM_RIGHT", LV_ALIGN_OUT_BOTTOM_RIGHT);
obj_setInt(self, "OUT_LEFT_TOP", LV_ALIGN_OUT_LEFT_TOP);
obj_setInt(self, "OUT_LEFT_MID", LV_ALIGN_OUT_LEFT_MID);
obj_setInt(self, "OUT_LEFT_BOTTOM", LV_ALIGN_OUT_LEFT_BOTTOM);
obj_setInt(self, "OUT_RIGHT_TOP", LV_ALIGN_OUT_RIGHT_TOP);
obj_setInt(self, "OUT_RIGHT_MID", LV_ALIGN_OUT_RIGHT_MID);
obj_setInt(self, "OUT_RIGHT_BOTTOM", LV_ALIGN_OUT_RIGHT_BOTTOM);
}
void pika_lvgl_EVENT___init__(PikaObj* self) {
obj_setInt(self, "ALL", LV_EVENT_ALL);
obj_setInt(self, "PRESSED", LV_EVENT_PRESSED);
obj_setInt(self, "PRESSING", LV_EVENT_PRESSING);
obj_setInt(self, "PRESS_LOST", LV_EVENT_PRESS_LOST);
obj_setInt(self, "SHORT_CLICKED", LV_EVENT_SHORT_CLICKED);
obj_setInt(self, "LONG_PRESSED", LV_EVENT_LONG_PRESSED);
obj_setInt(self, "LONG_PRESSED_REPEAT", LV_EVENT_LONG_PRESSED_REPEAT);
obj_setInt(self, "CLICKED", LV_EVENT_CLICKED);
obj_setInt(self, "RELEASED", LV_EVENT_RELEASED);
obj_setInt(self, "SCROLL_BEGIN", LV_EVENT_SCROLL_BEGIN);
obj_setInt(self, "SCROLL_END", LV_EVENT_SCROLL_END);
obj_setInt(self, "SCROLL", LV_EVENT_SCROLL);
obj_setInt(self, "GESTURE", LV_EVENT_GESTURE);
obj_setInt(self, "KEY", LV_EVENT_KEY);
obj_setInt(self, "FOCUSED", LV_EVENT_FOCUSED);
obj_setInt(self, "DEFOCUSED", LV_EVENT_DEFOCUSED);
obj_setInt(self, "LEAVE", LV_EVENT_LEAVE);
obj_setInt(self, "HIT_TEST", LV_EVENT_HIT_TEST);
obj_setInt(self, "COVER_CHECK", LV_EVENT_COVER_CHECK);
obj_setInt(self, "REFR_EXT_DRAW_SIZE", LV_EVENT_REFR_EXT_DRAW_SIZE);
obj_setInt(self, "DRAW_MAIN_BEGIN", LV_EVENT_DRAW_MAIN_BEGIN);
obj_setInt(self, "DRAW_MAIN", LV_EVENT_DRAW_MAIN);
obj_setInt(self, "DRAW_MAIN_END", LV_EVENT_DRAW_MAIN_END);
obj_setInt(self, "DRAW_POST_BEGIN", LV_EVENT_DRAW_POST_BEGIN);
obj_setInt(self, "DRAW_POST", LV_EVENT_DRAW_POST);
obj_setInt(self, "DRAW_POST_END", LV_EVENT_DRAW_POST_END);
obj_setInt(self, "DRAW_PART_BEGIN", LV_EVENT_DRAW_PART_BEGIN);
obj_setInt(self, "DRAW_PART_END", LV_EVENT_DRAW_PART_END);
obj_setInt(self, "VALUE_CHANGED", LV_EVENT_VALUE_CHANGED);
obj_setInt(self, "INSERT", LV_EVENT_INSERT);
obj_setInt(self, "REFRESH", LV_EVENT_REFRESH);
obj_setInt(self, "READY", LV_EVENT_READY);
obj_setInt(self, "CANCEL", LV_EVENT_CANCEL);
obj_setInt(self, "DELETE", LV_EVENT_DELETE);
obj_setInt(self, "CHILD_CHANGED", LV_EVENT_CHILD_CHANGED);
obj_setInt(self, "CHILD_CREATED", LV_EVENT_CHILD_CREATED);
obj_setInt(self, "CHILD_DELETED", LV_EVENT_CHILD_DELETED);
obj_setInt(self, "SCREEN_UNLOAD_START", LV_EVENT_SCREEN_UNLOAD_START);
obj_setInt(self, "SCREEN_LOAD_START", LV_EVENT_SCREEN_LOAD_START);
obj_setInt(self, "SCREEN_LOADED", LV_EVENT_SCREEN_LOADED);
obj_setInt(self, "SCREEN_UNLOADED", LV_EVENT_SCREEN_UNLOADED);
obj_setInt(self, "SIZE_CHANGED", LV_EVENT_SIZE_CHANGED);
obj_setInt(self, "STYLE_CHANGED", LV_EVENT_STYLE_CHANGED);
obj_setInt(self, "LAYOUT_CHANGED", LV_EVENT_LAYOUT_CHANGED);
obj_setInt(self, "GET_SELF_SIZE", LV_EVENT_GET_SELF_SIZE);
obj_setInt(self, "PREPROCESS", LV_EVENT_PREPROCESS);
}
void pika_lvgl_OPA___init__(PikaObj* self) {
obj_setInt(self, "TRANSP", LV_OPA_TRANSP);
obj_setInt(self, "COVER", LV_OPA_COVER);
}
void pika_lvgl_PALETTE___init__(PikaObj* self) {
obj_setInt(self, "RED", LV_PALETTE_RED);
obj_setInt(self, "PINK", LV_PALETTE_PINK);
obj_setInt(self, "PURPLE", LV_PALETTE_PURPLE);
obj_setInt(self, "DEEP_PURPLE", LV_PALETTE_DEEP_PURPLE);
obj_setInt(self, "INDIGO", LV_PALETTE_INDIGO);
obj_setInt(self, "BLUE", LV_PALETTE_BLUE);
obj_setInt(self, "LIGHT_BLUE", LV_PALETTE_LIGHT_BLUE);
obj_setInt(self, "CYAN", LV_PALETTE_CYAN);
obj_setInt(self, "TEAL", LV_PALETTE_TEAL);
obj_setInt(self, "GREEN", LV_PALETTE_GREEN);
obj_setInt(self, "LIGHT_GREEN", LV_PALETTE_LIGHT_GREEN);
obj_setInt(self, "LIME", LV_PALETTE_LIME);
obj_setInt(self, "YELLOW", LV_PALETTE_YELLOW);
obj_setInt(self, "AMBER", LV_PALETTE_AMBER);
obj_setInt(self, "ORANGE", LV_PALETTE_ORANGE);
obj_setInt(self, "DEEP_ORANGE", LV_PALETTE_DEEP_ORANGE);
obj_setInt(self, "BROWN", LV_PALETTE_BROWN);
obj_setInt(self, "BLUE_GREY", LV_PALETTE_BLUE_GREY);
obj_setInt(self, "GREY", LV_PALETTE_GREY);
obj_setInt(self, "NONE", LV_PALETTE_NONE);
}
PikaObj* pika_lvgl_screen_active(PikaObj* self) {
PikaObj* new_obj = newNormalObj(New_TinyObj);
lv_obj_t* lv_obj = lv_screen_active();
obj_setPtr(new_obj, "lv_obj", lv_obj);
return new_obj;
}
void pika_lvgl___init__(PikaObj* self) {
obj_newDirectObj(self, "lv_event_listener", New_TinyObj);
pika_lv_event_listener_g = obj_getObj(self, "lv_event_listener");
}
PikaObj* pika_lvgl_obj(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_obj_create(lv_parent);
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_obj);
obj_setPtr(new_obj, "lv_obj", lv_obj);
return new_obj;
}
PikaObj* pika_lvgl_palette_lighten(PikaObj *self, int p, int lvl){
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_color_t);
lv_color_t lv_color = lv_palette_lighten(p, lvl);
args_setStruct(new_obj->list, "lv_color_struct", lv_color);
lv_color_t* plv_color = args_getStruct(new_obj->list, "lv_color_struct");
obj_setPtr(new_obj, "lv_color", plv_color);
return new_obj;
}
PikaObj* pika_lvgl_palette_main(PikaObj* self, int p) {
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_color_t);
lv_color_t lv_color = lv_palette_main(p);
args_setStruct(new_obj->list, "lv_color_struct", lv_color);
obj_setPtr(new_obj, "lv_color",
args_getStruct(new_obj->list, "lv_color_struct"));
return new_obj;
}
PikaObj* pika_lvgl_indev_get_active(PikaObj *self){
PikaObj* new_obj = newNormalObj(New_pika_lvgl_indev_t);
lv_indev_t *lv_indev = lv_indev_active();
obj_setPtr(new_obj,"lv_indev", lv_indev);
return new_obj;
}
PikaObj* pika_lvgl_timer_create_basic(PikaObj *self){
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_timer_t);
lv_timer_t *lv_timer = lv_timer_create_basic();
obj_setPtr(new_obj,"lv_timer", lv_timer);
return new_obj;
}
#endif

View File

@ -0,0 +1,263 @@
from PikaObj import *
def __init__(): ...
class EVENT:
ALL: int
PRESSED: int
PRESSING: int
PRESS_LOST: int
SHORT_CLICKED: int
LONG_PRESSED: int
LONG_PRESSED_REPEAT: int
CLICKED: int
RELEASED: int
SCROLL_BEGIN: int
SCROLL_END: int
SCROLL: int
GESTURE: int
KEY: int
FOCUSED: int
DEFOCUSED: int
LEAVE: int
HIT_TEST: int
COVER_CHECK: int
REFR_EXT_DRAW_SIZE: int
DRAW_MAIN_BEGIN: int
DRAW_MAIN: int
DRAW_MAIN_END: int
DRAW_POST_BEGIN: int
DRAW_POST: int
DRAW_POST_END: int
DRAW_PART_BEGIN: int
DRAW_PART_END: int
VALUE_CHANGED: int
INSERT: int
REFRESH: int
READY: int
CANCEL: int
DELETE: int
CHILD_CHANGED: int
CHILD_CREATED: int
CHILD_DELETED: int
SCREEN_UNLOAD_START: int
SCREEN_LOAD_START: int
SCREEN_LOADED: int
SCREEN_UNLOADED: int
SIZE_CHANGED: int
STYLE_CHANGED: int
LAYOUT_CHANGED: int
GET_SELF_SIZE: int
PREPROCESS: int
def __init__(self): ...
class ALIGN:
DEFAULT: int
TOP_LEFT: int
TOP_MID: int
TOP_RIGHT: int
BOTTOM_LEFT: int
BOTTOM_MID: int
BOTTOM_RIGHT: int
LEFT_MID: int
RIGHT_MID: int
CENTER: int
OUT_TOP_LEFT: int
OUT_TOP_MID: int
OUT_TOP_RIGHT: int
OUT_BOTTOM_LEFT: int
OUT_BOTTOM_MID: int
OUT_BOTTOM_RIGHT: int
OUT_LEFT_TOP: int
OUT_LEFT_MID: int
OUT_LEFT_BOTTOM: int
OUT_RIGHT_TOP: int
OUT_RIGHT_MID: int
OUT_RIGHT_BOTTOM: int
def __init__(self): ...
class PALETTE:
RED: int
PINK: int
PURPLE: int
DEEP_PURPLE: int
INDIGO: int
BLUE: int
LIGHT_BLUE: int
CYAN: int
TEAL: int
GREEN: int
LIGHT_GREEN: int
LIME: int
YELLOW: int
AMBER: int
ORANGE: int
DEEP_ORANGE: int
BROWN: int
BLUE_GREY: int
GREY: int
NONE: int
def __init__(self): ...
class OPA:
TRANSP: int
COVER: int
def __init__(self): ...
class ANIM:
OFF: int
ON: int
def __init__(self): ...
class STATE:
def __init__(self): ...
class lv_event:
def get_code(self) -> int: ...
def get_target(self) -> lv_obj: ...
class lv_color_t: ...
class lv_timer_t:
def set_period(period: int): ...
def set_cb(cb: any): ...
def _del(self): ...
def palette_lighten(p: int, lvl: int) -> lv_color_t: ...
def palette_main(p: int) -> lv_color_t: ...
class style_t:
def __init__(self): ...
def init(self): ...
def set_radius(self, radius: int): ...
def set_bg_opa(self, opa: int): ...
def set_bg_color(self, color: lv_color_t): ...
def set_outline_width(self, w: int): ...
def set_outline_color(self, color: lv_color_t): ...
def set_outline_pad(self, pad: int): ...
def set_shadow_width(self, w: int): ...
def set_shadow_spread(self, s: int): ...
def set_shadow_color(self, color: lv_color_t): ...
class lv_obj:
def center(self): ...
def set_size(self, size_x: int, size_y: int): ...
def align(self, align: int, x_ofs: int, y_ofs: int): ...
def set_height(self, h: int): ...
def update_layout(self): ...
def set_width(self, w: int): ...
def add_state(self, state: int): ...
def add_event(self, event_cb: any, filter: int, user_data: pointer): ...
def add_style(self, style: style_t, selector: int): ...
def get_x(self) -> int: ...
def get_y(self) -> int: ...
def set_pos(self, x: int, y: int): ...
class indev_t:
def get_vect(self, point: point_t): ...
def obj(parent: lv_obj) -> lv_obj: ...
def indev_get_act() -> indev_t: ...
class point_t:
def __init__(self): ...
class arc(lv_obj):
MODE_NORMAL: int
MODE_SYMMETRICAL: int
MODE_REVERSE: int
def __init__(self, parent: lv_obj): ...
def set_start_angle(self, start: int): ...
def set_end_angle(self, angle: int): ...
def set_angles(self, start: int, end: int): ...
def set_bg_start_angle(self, start: int): ...
def set_bg_end_angle(self, angle: int): ...
def set_bg_angles(self, start: int, end: int): ...
def set_rotation(self, rotation: int): ...
def set_mode(self, mode: int): ...
def set_value(self, value: int): ...
def set_range(self, min: int, max: int): ...
def set_change_rate(self, rate: int): ...
def get_angle_start(self) -> int: ...
def get_angle_end(self) -> int: ...
def get_bg_angle_start(self) -> int: ...
def get_bg_angle_end(self) -> int: ...
def get_value(self) -> int: ...
def get_min_value(self) -> int: ...
def get_max_value(self) -> int: ...
def get_mode(self) -> int: ...
# def get_rotation(self) -> int: ...
class bar(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_value(self, value: int, anim: int): ...
def set_start_value(self, start_value: int, anim: int): ...
def set_range(self, min: int, max: int): ...
def set_mode(self, mode: int): ...
def get_value(self) -> int: ...
def get_start_value(self) -> int: ...
def get_min_value(self) -> int: ...
def get_max_value(self) -> int: ...
def get_mode(self) -> int: ...
class btn(lv_obj):
def __init__(self, parent: lv_obj): ...
class checkbox(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_text(self, txt: str): ...
def set_text_static(self, txt: str): ...
def get_text(self) -> str: ...
class dropdown(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_text(self, txt: str): ...
def set_options(self, options: str): ...
def add_option(self, option: str, pos:int): ...
def clear_options(self): ...
def set_selected(self, sel_opt: int): ...
def set_dir(self, dir: int): ...
def set_symbol(self, symbol: str): ...
def set_selected_highlight(self, en: int): ...
# def get_list(self) -> lv_obj: ...
def get_text(self) -> str: ...
def get_options(self) -> str: ...
def get_selected(self) -> int: ...
def get_option_cnt(self) -> int: ...
def get_selected_str(self) -> str: ...
def get_option_index(self, option: str) -> int: ...
def get_symbol(self) -> str: ...
def get_selected_highlight(self) -> int: ...
def get_dir(self) -> int: ...
def open(self): ...
def close(self): ...
def is_open(self) -> int: ...
class label(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_text(self, txt: str): ...
def set_long_mode(self, mode: int): ...
def set_recolor(self, en: int): ...
def set_style_text_align(self, value: int, selector: int): ...
class roller(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_options(self, options: str, mode: int): ...
def set_visible_row_count(self, row_cnt: int): ...
class slider(lv_obj):
def __init__(self, parent: lv_obj): ...
class switch(lv_obj):
def __init__(self, parent: lv_obj): ...
class table(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_cell_value(self, row: int, col: int, txt: str): ...
class textarea(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_one_line(en: int): ...
def scr_act() -> lv_obj: ...
def timer_create_basic() -> lv_timer_t: ...

View File

@ -0,0 +1,18 @@
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
#include "lvgl.h"
#else
#include "../../lvgl.h"
#endif
#ifdef PIKASCRIPT
#include "pika_lvgl_indev_t.h"
void pika_lvgl_indev_t_get_vect(PikaObj* self, PikaObj* point) {
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
lv_point_t* lv_point = obj_getPtr(point, "lv_point");
lv_indev_get_vect(lv_indev, lv_point);
obj_setInt(point, "x", lv_point->x);
obj_setInt(point, "y", lv_point->y);
}
#endif

View File

@ -0,0 +1,24 @@
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
#include "lvgl.h"
#else
#include "../../lvgl.h"
#endif
#ifdef PIKASCRIPT
#include "pika_lvgl_lv_event.h"
int pika_lvgl_lv_event_get_code(PikaObj *self){
lv_event_t *lv_event = obj_getPtr(self, "lv_event");
return lv_event_get_code(lv_event);
}
PikaObj *New_pika_lvgl_lv_obj(Args *args);
PikaObj* pika_lvgl_lv_event_get_target(PikaObj *self){
lv_event_t *lv_event = obj_getPtr(self, "lv_event");
lv_obj_t* lv_obj = lv_event_get_target(lv_event);
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_obj);
obj_setPtr(new_obj, "lv_obj", lv_obj);
return new_obj;
}
#endif

View File

@ -0,0 +1,116 @@
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
#include "lvgl.h"
#else
#include "../../lvgl.h"
#endif
#ifdef PIKASCRIPT
#include "pika_lvgl_lv_obj.h"
#include "BaseObj.h"
#include "dataStrs.h"
#include "pika_lvgl.h"
#include "pika_lvgl_arc.h"
#include "pika_lvgl_lv_event.h"
extern PikaObj* pika_lv_event_listener_g;
void pika_lvgl_lv_obj_center(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_center(lv_obj);
}
void pika_lvgl_lv_obj_set_size(PikaObj* self, int size_x, int size_y) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_set_size(lv_obj, size_x, size_y);
}
void pika_lvgl_lv_obj_align(PikaObj* self, int align, int x_ofs, int y_ofs) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_align(lv_obj, align, x_ofs, y_ofs);
}
void pika_lvgl_lv_obj_set_height(PikaObj* self, int h) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_set_height(lv_obj, h);
}
void pika_lvgl_lv_obj_update_layout(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_update_layout(lv_obj);
}
void pika_lvgl_lv_obj_set_width(PikaObj* self, int w) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_set_width(lv_obj, w);
}
void pika_lvgl_lv_obj_add_state(PikaObj* self, int state) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_add_state(lv_obj, state);
}
PikaObj* eventLisener_getHandler(PikaObj* self, uintptr_t event_id) {
Args buffs = {0};
char* event_name =
strsFormat(&buffs, PIKA_SPRINTF_BUFF_SIZE, "%d", event_id);
PikaObj* event_item = obj_getObj(self, event_name);
PikaObj* event_handler = obj_getPtr(event_item, "handler");
strsDeinit(&buffs);
return event_handler;
}
static void __pika_event_cb(lv_event_t* e) {
lv_obj_t* target = lv_event_get_target(e);
PikaObj* event_handler =
eventLisener_getHandler(pika_lv_event_listener_g, (uintptr_t)target);
PikaObj* evt = obj_getObj(event_handler, "_event_evt");
obj_setPtr(evt, "lv_event", e);
obj_run(event_handler, "_event_cb(_event_evt)");
}
void eventLicener_registerEvent(PikaObj* self,
uintptr_t event_id,
PikaObj* event_handler) {
Args buffs = {0};
char* event_name =
strsFormat(&buffs, PIKA_SPRINTF_BUFF_SIZE, "%d", event_id);
obj_newDirectObj(self, event_name, New_TinyObj);
PikaObj* event_item = obj_getObj(self, event_name);
obj_setRef(event_item, "handler", event_handler);
strsDeinit(&buffs);
}
void pika_lvgl_lv_obj_add_event_cb(PikaObj* self,
Arg* event_cb,
int filter,
void* user_data) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_add_event_cb(lv_obj, __pika_event_cb, filter, NULL);
obj_setArg(self, "_event_cb", event_cb);
obj_setPtr(self, "_event_user_data", user_data);
obj_newDirectObj(self, "_event_evt", New_pika_lvgl_lv_event);
eventLicener_registerEvent(pika_lv_event_listener_g, (uintptr_t)lv_obj, self);
}
void pika_lvgl_lv_obj_add_style(PikaObj *self, PikaObj* style, int selector){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_style_t* lv_style = obj_getPtr(style, "lv_style");
lv_obj_add_style(lv_obj, lv_style, selector);
}
int pika_lvgl_lv_obj_get_x(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_obj_get_x(lv_obj);
}
int pika_lvgl_lv_obj_get_y(PikaObj *self){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_obj_get_y(lv_obj);
}
void pika_lvgl_lv_obj_set_pos(PikaObj *self, int x, int y){
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_set_pos(lv_obj, x, y);
}
#endif

View File

@ -0,0 +1,70 @@
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
#include "lvgl.h"
#else
#include "../../lvgl.h"
#endif
#ifdef PIKASCRIPT
#include "pika_lvgl_style_t.h"
void pika_lvgl_style_t_init(PikaObj* self) {
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_style_init(lv_style);
}
void pika_lvgl_style_t_set_bg_color(PikaObj* self, PikaObj* color) {
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_color_t* lv_color = obj_getPtr(color, "lv_color");
lv_style_set_bg_color(lv_style, *lv_color);
}
void pika_lvgl_style_t_set_bg_opa(PikaObj* self, int opa) {
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_style_set_bg_opa(lv_style, opa);
}
void pika_lvgl_style_t_set_outline_color(PikaObj* self, PikaObj* color) {
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_color_t* lv_color = obj_getPtr(color, "lv_color");
lv_style_set_outline_color(lv_style, *lv_color);
}
void pika_lvgl_style_t_set_outline_pad(PikaObj* self, int pad) {
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_style_set_outline_pad(lv_style, pad);
}
void pika_lvgl_style_t_set_outline_width(PikaObj* self, int w) {
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_style_set_outline_width(lv_style, w);
}
void pika_lvgl_style_t_set_radius(PikaObj* self, int radius) {
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_style_set_radius(lv_style, radius);
}
void pika_lvgl_style_t___init__(PikaObj* self) {
lv_style_t lv_style_stack = {0};
args_setStruct(self->list, "lv_style_struct", lv_style_stack);
lv_style_t* lv_style = args_getStruct(self->list, "lv_style_struct");
obj_setPtr(self, "lv_style", lv_style);
}
void pika_lvgl_style_t_set_shadow_color(PikaObj *self, PikaObj* color){
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_color_t* lv_color = obj_getPtr(color, "lv_color");
lv_style_set_shadow_color(lv_style, *lv_color);
}
void pika_lvgl_style_t_set_shadow_spread(PikaObj *self, int s){
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_style_set_shadow_spread(lv_style, s);
}
void pika_lvgl_style_t_set_shadow_width(PikaObj *self, int w){
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_style_set_shadow_width(lv_style, w);
}
#endif

View File

@ -0,0 +1,70 @@
from building import *
import rtconfig
import os
src = []
inc = []
group = []
cwd = GetCurrentDir() # get current dir path
port_src = Glob('*.c')
port_inc = [cwd]
group = group + DefineGroup('LVGL-port', port_src, depend = ['PKG_USING_LVGL'], CPPPATH = port_inc)
# check if .h or .hpp files exists
def check_h_hpp_exists(path):
file_dirs = os.listdir(path)
for file_dir in file_dirs:
if os.path.splitext(file_dir)[1] in ['.h', '.hpp']:
return True
return False
lvgl_cwd = cwd + '/../../'
lvgl_src_cwd = lvgl_cwd + 'src/'
inc = inc + [lvgl_src_cwd]
src = src + Glob(os.path.join(lvgl_src_cwd,'*.c'))
for root, dirs, files in os.walk(lvgl_src_cwd):
for dir in dirs:
current_path = os.path.join(root, dir)
src = src + Glob(os.path.join(current_path,'*.c')) # add all .c files
if check_h_hpp_exists(current_path): # add .h and .hpp path
inc = inc + [current_path]
if GetDepend('PKG_LVGL_USING_EXAMPLES'):
lvgl_src_cwd = lvgl_cwd + 'examples/'
inc = inc + [lvgl_src_cwd]
for root, dirs, files in os.walk(lvgl_src_cwd):
for dir in dirs:
current_path = os.path.join(root, dir)
src = src + Glob(os.path.join(current_path,'*.c'))
if check_h_hpp_exists(current_path):
inc = inc + [current_path]
if GetDepend('PKG_LVGL_USING_DEMOS'):
lvgl_src_cwd = lvgl_cwd + 'demos/'
inc = inc + [lvgl_src_cwd]
for root, dirs, files in os.walk(lvgl_src_cwd):
for dir in dirs:
current_path = os.path.join(root, dir)
src = src + Glob(os.path.join(current_path,'*.c'))
if check_h_hpp_exists(current_path):
inc = inc + [current_path]
LOCAL_CFLAGS = ''
if rtconfig.PLATFORM == 'gcc' or rtconfig.PLATFORM == 'armclang': # GCC or Keil AC6
LOCAL_CFLAGS += ' -std=c99'
elif rtconfig.PLATFORM == 'armcc': # Keil AC5
LOCAL_CFLAGS += ' --c99 --gnu'
group = group + DefineGroup('LVGL', src, depend = ['PKG_USING_LVGL'], CPPPATH = inc, LOCAL_CFLAGS = LOCAL_CFLAGS)
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
group = group + SConscript(os.path.join(d, 'SConscript'))
Return('group')

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: MIT
*
* Change Logs:
* Date Author Notes
* 2021-10-15 Meco Man The first version
*/
#ifndef LV_RT_THREAD_CONF_H
#define LV_RT_THREAD_CONF_H
#ifdef __RTTHREAD__
#define LV_RTTHREAD_INCLUDE <rtthread.h>
#include LV_RTTHREAD_INCLUDE
/*=========================
STDLIB WRAPPER SETTINGS
*=========================*/
#ifdef RT_USING_HEAP
#define LV_USE_STDLIB_MALLOC LV_STDLIB_RTTHREAD
#endif
#define LV_USE_STDLIB_STRING LV_STDLIB_RTTHREAD
#if LV_USE_FLOAT == 0
#define LV_USE_STDLIB_SPRINTF LV_STDLIB_RTTHREAD
#endif
/*=================
* OPERATING SYSTEM
*=================*/
#define LV_USE_OS LV_OS_RTTHREAD
/*-------------
* Asserts
*-----------*/
#define LV_ASSERT_HANDLER_INCLUDE LV_RTTHREAD_INCLUDE
#define LV_ASSERT_HANDLER RT_ASSERT(0);
/*=====================
* COMPILER SETTINGS
*====================*/
#ifdef ARCH_CPU_BIG_ENDIAN
#define LV_BIG_ENDIAN_SYSTEM 1
#else
#define LV_BIG_ENDIAN_SYSTEM 0
#endif
#ifdef rt_align /* >= RT-Thread v5.0.0 */
#define LV_ATTRIBUTE_MEM_ALIGN rt_align(RT_ALIGN_SIZE)
#else
#define LV_ATTRIBUTE_MEM_ALIGN ALIGN(RT_ALIGN_SIZE)
#endif
/*==================
* EXAMPLES
*==================*/
#ifdef PKG_LVGL_USING_EXAMPLES
#define LV_BUILD_EXAMPLES 1
#endif
/*--END OF LV_RT_THREAD_CONF_H--*/
#endif /*__RTTHREAD__*/
#endif /*LV_CONF_H*/

View File

@ -0,0 +1,90 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: MIT
*
* Change Logs:
* Date Author Notes
* 2021-10-18 Meco Man the first version
* 2022-05-10 Meco Man improve rt-thread initialization process
*/
#ifdef __RTTHREAD__
#include <lvgl.h>
#include <rtthread.h>
#define DBG_TAG "LVGL"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#ifndef PKG_LVGL_THREAD_STACK_SIZE
#define PKG_LVGL_THREAD_STACK_SIZE 4096
#endif /* PKG_LVGL_THREAD_STACK_SIZE */
#ifndef PKG_LVGL_THREAD_PRIO
#define PKG_LVGL_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
#endif /* PKG_LVGL_THREAD_PRIO */
#ifndef PKG_LVGL_DISP_REFR_PERIOD
#define PKG_LVGL_DISP_REFR_PERIOD 33
#endif /* PKG_LVGL_DISP_REFR_PERIOD */
extern void lv_port_disp_init(void);
extern void lv_port_indev_init(void);
extern void lv_user_gui_init(void);
static struct rt_thread lvgl_thread;
#ifdef rt_align
rt_align(RT_ALIGN_SIZE)
#else
ALIGN(RT_ALIGN_SIZE)
#endif
static rt_uint8_t lvgl_thread_stack[PKG_LVGL_THREAD_STACK_SIZE];
#if LV_USE_LOG
static void lv_rt_log(const char *buf)
{
LOG_I(buf);
}
#endif /* LV_USE_LOG */
static void lvgl_thread_entry(void *parameter)
{
#if LV_USE_LOG
lv_log_register_print_cb(lv_rt_log);
#endif /* LV_USE_LOG */
lv_init();
lv_port_disp_init();
lv_port_indev_init();
lv_user_gui_init();
lv_tick_set_cb(&rt_tick_get_millisecond);
/* handle the tasks of LVGL */
while(1)
{
lv_task_handler();
rt_thread_mdelay(PKG_LVGL_DISP_REFR_PERIOD);
}
}
static int lvgl_thread_init(void)
{
rt_err_t err;
err = rt_thread_init(&lvgl_thread, "LVGL", lvgl_thread_entry, RT_NULL,
&lvgl_thread_stack[0], sizeof(lvgl_thread_stack), PKG_LVGL_THREAD_PRIO, 10);
if(err != RT_EOK)
{
LOG_E("Failed to create LVGL thread");
return -1;
}
rt_thread_startup(&lvgl_thread);
return 0;
}
INIT_ENV_EXPORT(lvgl_thread_init);
#endif /*__RTTHREAD__*/

View File

@ -0,0 +1,4 @@
This folder is for LVGL SquareLine Studio
SquareLine Studio can automatically put the generated C files into `ui` folder, so that rt-thread will automatically detect them; or, as a user, you can move the generated C files into `ui` folder manually.

View File

@ -0,0 +1,25 @@
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
inc = [cwd]
# check if .h or .hpp files exists
def check_h_hpp_exists(path):
file_dirs = os.listdir(path)
for file_dir in file_dirs:
if os.path.splitext(file_dir)[1] in ['.h', '.hpp']:
return True
return False
sls_src_cwd = cwd
for root, dirs, files in os.walk(sls_src_cwd):
for dir in dirs:
current_path = os.path.join(root, dir)
src = src + Glob(os.path.join(current_path,'*.c')) # add all .c files
if check_h_hpp_exists(current_path): # add .h and .hpp path
inc = inc + [current_path]
group = DefineGroup('LVGL-SquareLine', src, depend = ['PKG_USING_LVGL_SQUARELINE'], CPPPATH = inc)
Return('group')

View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: MIT
*
* Change Logs:
* Date Author Notes
* 2022-05-13 Meco Man First version
*/
#ifdef __RTTHREAD__
void lv_user_gui_init(void)
{
extern void ui_init(void);
ui_init();
}
#endif /* __RTTHREAD__ */

View File

@ -0,0 +1,15 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: MIT
*
* Change Logs:
* Date Author Notes
* 2022-11-20 Meco Man The first version
*/
#ifdef __RTTHREAD__
#include "../../../../../lvgl.h" /* back to the root folder's lvgl.h */
#endif /* __RTTHREAD__ */

View File

@ -0,0 +1,2 @@
build:
cmake: .