/* * Copyright (C) 2022-2025 ArtInChip Technology Co., Ltd. * * SPDX-License-Identifier: Apache-2.0 * * Authors: Ning Fang */ #include "lvgl.h" #include "aic_ui.h" #include "aic_osal.h" #include "lvgl/demos/lv_demos.h" #if defined(KERNEL_RTTHREAD) #include #include #endif #ifdef AIC_USE_TOUCH_MONKEY_TEST #if LV_USE_MONKEY static void use_touch_monkey_test(void) { /*Create encoder monkey test*/ lv_monkey_config_t config; lv_monkey_config_init(&config); config.type = LV_INDEV_TYPE_POINTER; config.period_range.min = AIC_USE_TOUCH_MONKEY_TEST_PERIOD_RANG_MIN; config.period_range.max = AIC_USE_TOUCH_MONKEY_TEST_PERIOD_RANG_MAX; config.input_range.min = AIC_USE_TOUCH_MONKEY_TEST_INPUT_RANG_MAX; config.input_range.max = AIC_USE_TOUCH_MONKEY_TEST_PERIOD_RANG_MAX; lv_monkey_t * monkey = lv_monkey_create(&config); /*Set the default group*/ lv_group_t * group = lv_group_create(); lv_indev_set_group(lv_monkey_get_indev(monkey), group); lv_group_set_default(group); /*Start monkey test*/ lv_monkey_set_enable(monkey, true); } #endif #endif static void lvgl_data_check(void) { #if defined(KERNEL_RTTHREAD) DIR *dirp = NULL; int loops = 0; while ((dirp = opendir(LVGL_STORAGE_PATH)) == NULL) { loops++; aicos_msleep(1*10); if (loops > 20) break; } if (dirp) closedir(dirp); if (loops > 20) LV_LOG_ERROR(LVGL_STORAGE_PATH" is not ready yet!\n"); #endif } #ifdef AIC_LVGL_DEMO void aic_ui_init() { lvgl_data_check(); extern void ui_init(void); ui_init(); #ifdef AIC_USE_TOUCH_MONKEY_TEST use_touch_monkey_test(); #endif return; } #endif