lvgl科普
lvgl 主要特点:
Github库整体了解
版本号编排原则
屏幕兼容性
LVGL 问题处理:
lvgl 与 FreeRTOS
由于esp-idf本身带了 FreeRTOS系统,因此需要关注一下操作系统相关的内容:
void lvgl_thread(void)
{
while(1) {
uint32_t time_till_next;
time_till_next = lv_timer_handler(); /*lv_lock/lv_unlock is called internally*/
thread_sleep(time_till_next); /* sleep for a while */
}
}
void other_thread(void)
{
/* You must always hold the mutex while using LVGL APIs */
lv_lock();
lv_obj_t *img = lv_image_create(lv_screen_active());
lv_unlock();
while(1) {
lv_lock();
/* change to the next image */
lv_image_set_src(img, next_image);
lv_unlock();
thread_sleep(2000);
}
}
以上的内容,总结一下:
1. 如果要用到操作系统,LV_USE_OS宏定义应该被设置。
2. 每当在其他线程(不是 lv_timer_handler()
函数所在的线程 )使用lvgl函数的时候,在其之前使用 lv_lock()
和 lv_unlock()
两个函数