feat(rtthread): add cpu usage support (#6310)
This commit is contained in:
@@ -30,6 +30,14 @@
|
||||
#define LV_USE_STDLIB_SPRINTF LV_STDLIB_RTTHREAD
|
||||
#endif
|
||||
|
||||
/*=========================
|
||||
CPU usage
|
||||
*=========================*/
|
||||
|
||||
#ifdef PKG_USING_CPU_USAGE
|
||||
#define LV_SYSMON_GET_IDLE lv_timer_os_get_idle
|
||||
#endif /* PKG_USING_CPU_USAGE */
|
||||
|
||||
/*=================
|
||||
* OPERATING SYSTEM
|
||||
*=================*/
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <rtthread.h>
|
||||
#ifdef PKG_USING_CPU_USAGE
|
||||
#include "cpu_usage.h"
|
||||
#endif /* PKG_USING_CPU_USAGE */
|
||||
|
||||
#define DBG_TAG "LVGL"
|
||||
#define DBG_LVL DBG_INFO
|
||||
@@ -50,6 +53,13 @@ static void lv_rt_log(const char *buf)
|
||||
}
|
||||
#endif /* LV_USE_LOG */
|
||||
|
||||
#ifdef PKG_USING_CPU_USAGE
|
||||
uint32_t lv_timer_os_get_idle(void)
|
||||
{
|
||||
return (100 - (uint32_t)cpu_load_average());
|
||||
}
|
||||
#endif /* PKG_USING_CPU_USAGE */
|
||||
|
||||
static void lvgl_thread_entry(void *parameter)
|
||||
{
|
||||
#if LV_USE_LOG
|
||||
@@ -62,6 +72,10 @@ static void lvgl_thread_entry(void *parameter)
|
||||
|
||||
lv_tick_set_cb(&rt_tick_get_millisecond);
|
||||
|
||||
#ifdef PKG_USING_CPU_USAGE
|
||||
cpu_usage_init();
|
||||
#endif /* PKG_USING_CPU_USAGE */
|
||||
|
||||
/* handle the tasks of LVGL */
|
||||
while(1)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,6 @@ for root, dirs, files in os.walk(sls_src_cwd):
|
||||
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)
|
||||
group = DefineGroup('LVGL-SquareLine', src, depend = ['PKG_LVGL_USING_SQUARELINE'], CPPPATH = inc)
|
||||
|
||||
Return('group')
|
||||
|
||||
Reference in New Issue
Block a user