feat(rt-thread): implement rt-thread sconscirpt (#2674)

This commit is contained in:
Jianting (Meco) Man
2021-10-18 07:55:20 -05:00
committed by GitHub
parent 58ea2787b4
commit 9ece84de16
4 changed files with 191 additions and 7 deletions

View File

@@ -0,0 +1,104 @@
/*
* 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
/*====================
COLOR SETTINGS
*====================*/
#ifdef PKG_LVGL_ENABLE_COLOR_16_SWAP
#define LV_COLOR_16_SWAP 1
#else
#define LV_COLOR_16_SWAP 0
#endif
/*=========================
MEMORY SETTINGS
*=========================*/
#ifdef RT_USING_HEAP
/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
# define LV_MEM_CUSTOM 1
# define LV_MEM_CUSTOM_INCLUDE LV_RTTHREAD_INCLUDE
# define LV_MEM_CUSTOM_ALLOC rt_malloc
# define LV_MEM_CUSTOM_FREE rt_free
# define LV_MEM_CUSTOM_REALLOC rt_realloc
#endif
/*====================
HAL SETTINGS
*====================*/
/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#define LV_TICK_CUSTOM_INCLUDE LV_RTTHREAD_INCLUDE
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (rt_tick_get_millisecond()) /*Expression evaluating to current system time in ms*/
/*=======================
* FEATURE CONFIGURATION
*=======================*/
/*-------------
* Logging
*-----------*/
/*Enable the log module*/
#ifdef PKG_LVGL_ENABLE_LOG
# define LV_USE_LOG 1
# define LV_LOG_PRINTF 0
#else
# define LV_USE_LOG 0
#endif
/*-------------
* Asserts
*-----------*/
#define LV_ASSERT_HANDLER_INCLUDE LV_RTTHREAD_INCLUDE
#define LV_ASSERT_HANDLER RT_ASSERT(0);
/*-------------
* Others
*-----------*/
/*Change the built in (v)snprintf functions*/
#define LV_SPRINTF_CUSTOM 1
#define LV_SPRINTF_INCLUDE LV_RTTHREAD_INCLUDE
#define lv_snprintf rt_snprintf
#define lv_vsnprintf rt_vsnprintf
#define LV_SPRINTF_USE_FLOAT 0
/*=====================
* COMPILER SETTINGS
*====================*/
/*For big endian systems set to 1*/
#ifdef RT_USING_BIG_ENDIAN
# define LV_BIG_ENDIAN_SYSTEM 1
#else
# define LV_BIG_ENDIAN_SYSTEM 0
#endif
/*Will be added where memories needs to be aligned*/
#define LV_ATTRIBUTE_MEM_ALIGN ALIGN(4)
/*--END OF LV_RT_THREAD_CONF_H--*/
#endif /*__RTTHREAD__*/
#endif /*LV_CONF_H*/